_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q158700 | Interpreter.setShutdownOnExit | train | public static void setShutdownOnExit(final boolean value) {
try {
SYSTEM_OBJECT.getNameSpace().setVariable("shutdownOnExit", Boolean.valueOf(value), false);
} catch (final UtilEvalError utilEvalError) {
throw new IllegalStateException(utilEvalError);
}
} | java | {
"resource": ""
} |
q158701 | Interpreter.main | train | public static void main( String [] args )
{
if ( args.length > 0 ) {
String filename = args[0];
String [] bshArgs;
if ( args.length > 1 ) {
bshArgs = new String [ args.length -1 ];
System.arraycopy( args, 1, bshArgs, 0, args.length-1 );
... | java | {
"resource": ""
} |
q158702 | Interpreter.source | train | public Object source( String filename, NameSpace nameSpace )
throws FileNotFoundException, IOException, EvalError
{
File file = pathToFile( filename );
Interpreter.debug("Sourcing file: ", file);
Reader sourceIn = new BufferedReader( new FileReader(file) );
try {
... | java | {
"resource": ""
} |
q158703 | Interpreter.source | train | public Object source( String filename )
throws FileNotFoundException, IOException, EvalError
{
return source( filename, globalNameSpace );
} | java | {
"resource": ""
} |
q158704 | Interpreter.eval | train | public Object eval( Reader in ) throws EvalError
{
return eval( in, globalNameSpace, null == sourceFileInfo ? "eval stream" : sourceFileInfo );
} | java | {
"resource": ""
} |
q158705 | Interpreter.eval | train | public Object eval( String statements ) throws EvalError {
Interpreter.debug("eval(String): ", statements);
return eval(statements, globalNameSpace);
} | java | {
"resource": ""
} |
q158706 | Interpreter.eval | train | public Object eval( String statements, NameSpace nameSpace )
throws EvalError
{
String s = ( statements.endsWith(";") ? statements : statements+";" );
return eval(
new StringReader(s), nameSpace,
"inline evaluation of: ``"+ showEvalString(s)+"''" );
} | java | {
"resource": ""
} |
q158707 | Interpreter.debug | train | public final static void debug(Object... msg)
{
if ( DEBUG.get() ) {
StringBuilder sb = new StringBuilder();
for ( Object m : msg )
sb.append(m);
Console.debug.println("// Debug: " + sb.toString());
}
} | java | {
"resource": ""
} |
q158708 | Interpreter.getu | train | Object getu( String name ) {
try {
return get( name );
} catch ( EvalError e ) {
throw new InterpreterError("set: "+e, e);
}
} | java | {
"resource": ""
} |
q158709 | Interpreter.setu | train | void setu(String name, Object value) {
try {
set(name, value);
} catch ( EvalError e ) {
throw new InterpreterError("set: "+e, e);
}
} | java | {
"resource": ""
} |
q158710 | Interpreter.unset | train | public void unset( String name )
throws EvalError
{
/*
We jump through some hoops here to handle arbitrary cases like
unset("bsh.foo");
*/
CallStack callstack = new CallStack();
try {
LHS lhs = globalNameSpace.getNameResolver( name ).toLHS(... | java | {
"resource": ""
} |
q158711 | Interpreter.readLine | train | private boolean readLine() throws ParseException {
try {
return parser.Line();
} catch (ParseException e) {
yield();
if ( EOF )
return true;
throw e;
}
} | java | {
"resource": ""
} |
q158712 | Interpreter.pathToFile | train | public File pathToFile( String fileName )
throws IOException
{
String cwd = (String)getu("bsh.cwd");
File file = new File( fileName );
// if relative, fix up to bsh.cwd
if ( !file.isAbsolute() ) {
file = new File( cwd + File.separator + fileName );
}
... | java | {
"resource": ""
} |
q158713 | Interpreter.readObject | train | private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
stream.defaultReadObject();
// set transient fields
setOut( System.out );
setErr( System.err );
} | java | {
"resource": ""
} |
q158714 | BshClassPath.addComponent | train | public void addComponent( BshClassPath bcp ) {
if (bcp == null)
return;
if ( compPaths == null )
compPaths = new ArrayList();
compPaths.add( bcp );
bcp.addListener( this );
} | java | {
"resource": ""
} |
q158715 | BshClassPath.getClassesForPackage | train | synchronized public Set getClassesForPackage( String pack ) {
insureInitialized();
Set set = new HashSet();
Collection c = (Collection)packageMap.get( pack );
if ( c != null )
set.addAll( c );
if ( compPaths != null )
for (int i=0; i<compPaths.size(); i++... | java | {
"resource": ""
} |
q158716 | BshClassPath.getClassSource | train | synchronized public ClassSource getClassSource( String className )
{
// Before triggering classpath mapping (initialization) check for
// explicitly set class sources (e.g. generated classes). These would
// take priority over any found in the classpath anyway.
ClassSource cs = (Cla... | java | {
"resource": ""
} |
q158717 | BshClassPath.clearCachedStructures | train | synchronized private void clearCachedStructures() {
mapsInitialized = false;
packageMap = new HashMap();
classSource = new HashMap();
unqNameTable = null;
nameSpaceChanged();
} | java | {
"resource": ""
} |
q158718 | BshClassPath.traverseDirForClasses | train | static String [] traverseDirForClasses( File dir )
throws IOException
{
List list = traverseDirForClassesAux( dir, dir );
return (String[])list.toArray( new String[0] );
} | java | {
"resource": ""
} |
q158719 | BshClassPath.searchJrtFSForClasses | train | static String [] searchJrtFSForClasses( URL url ) throws IOException {
try {
Path path = FileSystems.getFileSystem(new URI("jrt:/")).getPath("modules", url.getPath());
return Files.walk(path).map(Path::toString)
.filter(BshClassPath::isClassFileName)
... | java | {
"resource": ""
} |
q158720 | BshClassPath.searchJarFSForClasses | train | static String [] searchJarFSForClasses( URL url ) throws IOException {
try {
try {
FileSystems.newFileSystem(url.toURI(), new HashMap<>());
} catch (FileSystemAlreadyExistsException e) { /* ignore */ }
Path path = FileSystems.getFileSystem(url.toURI()).getPat... | java | {
"resource": ""
} |
q158721 | BshClassPath.searchArchiveForClasses | train | static String [] searchArchiveForClasses( URL url ) throws IOException {
List<String> list = new ArrayList<>();
ZipInputStream zip = new ZipInputStream(url.openStream());
ZipEntry ze;
while( zip.available() == 1 )
if ( (ze = zip.getNextEntry()) != null
&&... | java | {
"resource": ""
} |
q158722 | BshClassPath.splitClassname | train | public static String [] splitClassname ( String classname ) {
classname = canonicalizeClassName( classname );
int i=classname.lastIndexOf(".");
String classn, packn;
if ( i == -1 ) {
// top level class
classn = classname;
packn="<unpackaged>";
... | java | {
"resource": ""
} |
q158723 | BshClassPath.removeInnerClassNames | train | public static Collection removeInnerClassNames( Collection col ) {
List list = new ArrayList();
list.addAll(col);
Iterator it = list.iterator();
while(it.hasNext()) {
String name =(String)it.next();
if (name.indexOf("$") != -1 )
it.remove();
... | java | {
"resource": ""
} |
q158724 | BshClassPath.getPackagesSet | train | public Set getPackagesSet()
{
insureInitialized();
Set set = new HashSet();
set.addAll( packageMap.keySet() );
if ( compPaths != null )
for (int i=0; i<compPaths.size(); i++)
set.addAll(
((BshClassPath)compPaths.get(i)).packageMap.keyS... | java | {
"resource": ""
} |
q158725 | BshClassPath.nameSpaceChanged | train | void nameSpaceChanged()
{
if ( nameSourceListeners == null )
return;
for(int i=0; i<nameSourceListeners.size(); i++)
((NameSource.Listener)(nameSourceListeners.get(i)))
.nameSourceChanged( this );
} | java | {
"resource": ""
} |
q158726 | BshClassPath.addNameSourceListener | train | public void addNameSourceListener( NameSource.Listener listener ) {
if ( nameSourceListeners == null )
nameSourceListeners = new ArrayList();
nameSourceListeners.add( listener );
} | java | {
"resource": ""
} |
q158727 | NameSpace.getClassInstance | train | Object getClassInstance() throws UtilEvalError {
if (this.classInstance != null)
return this.classInstance;
if (this.classStatic != null
// || (getParent()!=null && getParent().classStatic != null)
)
throw new UtilEvalError(
"Can't refer to clas... | java | {
"resource": ""
} |
q158728 | NameSpace.get | train | public Object get(final String name, final Interpreter interpreter)
throws UtilEvalError {
final CallStack callstack = new CallStack(this);
return this.getNameResolver(name).toObject(callstack, interpreter);
} | java | {
"resource": ""
} |
q158729 | NameSpace.setLocalVariable | train | public Variable setLocalVariable(final String name, final Object value,
final boolean strictJava) throws UtilEvalError {
return this.setVariable(name, value, strictJava, false/* recurse */);
} | java | {
"resource": ""
} |
q158730 | NameSpace.isChildOf | train | public boolean isChildOf(NameSpace parent) {
return null != this.getParent() && (
this.getParent().equals(parent)
|| this.getParent().isChildOf(parent));
} | java | {
"resource": ""
} |
q158731 | NameSpace.getSuper | train | public This getSuper(final Interpreter declaringInterpreter) {
if (this.parent != null)
return this.parent.getThis(declaringInterpreter);
else
return this.getThis(declaringInterpreter);
} | java | {
"resource": ""
} |
q158732 | NameSpace.getClassManager | train | public BshClassManager getClassManager() {
if (this.classManager != null)
return this.classManager;
if (this.parent != null && this.parent != JAVACODE)
return this.parent.getClassManager();
this.setClassManager(BshClassManager
.createClassManager(null/* in... | java | {
"resource": ""
} |
q158733 | NameSpace.getVariable | train | public Object getVariable(final String name, final boolean recurse)
throws UtilEvalError {
final Variable var = this.getVariableImpl(name, recurse);
return this.unwrapVariable(var);
} | java | {
"resource": ""
} |
q158734 | NameSpace.setTypedVariable | train | @Deprecated
public void setTypedVariable(final String name, final Class<?> type,
final Object value, final boolean isFinal) throws UtilEvalError {
final Modifiers modifiers = new Modifiers(Modifiers.FIELD);
if (isFinal)
modifiers.addModifier("final");
this.setTypedVar... | java | {
"resource": ""
} |
q158735 | NameSpace.setMethod | train | public void setMethod(BshMethod method) {
String name = method.getName();
if (!this.methods.containsKey(name))
this.methods.put(name, new ArrayList<BshMethod>(1));
this.methods.get(name).remove(method);
this.methods.get(name).add(0, method);
} | java | {
"resource": ""
} |
q158736 | NameSpace.getMethod | train | public BshMethod getMethod(final String name, final Class<?>[] sig)
throws UtilEvalError {
return this.getMethod(name, sig, false/* declaredOnly */);
} | java | {
"resource": ""
} |
q158737 | NameSpace.importClass | train | public void importClass(final String name) {
this.importedClasses.put(Name.suffix(name, 1), name);
this.nameSpaceChanged();
} | java | {
"resource": ""
} |
q158738 | NameSpace.importPackage | train | public void importPackage(final String name) {
this.importedPackages.remove(name);
this.importedPackages.add(0, name);
this.nameSpaceChanged();
} | java | {
"resource": ""
} |
q158739 | NameSpace.getImportedMethod | train | protected BshMethod getImportedMethod(final String name, final Class<?>[] sig)
throws UtilEvalError {
// Try object imports
for (final Object object : this.importedObjects) {
final Invocable method = Reflect.resolveJavaMethod(
object.getClass(), name, sig, fals... | java | {
"resource": ""
} |
q158740 | NameSpace.getImportedVar | train | protected Variable getImportedVar(final String name) throws UtilEvalError {
Variable var = null;
// Try object imports
for (final Object object : this.importedObjects) {
final Invocable field = Reflect.resolveJavaField(object.getClass(),
name, false/* onlyStatic *... | java | {
"resource": ""
} |
q158741 | NameSpace.loadScriptedCommand | train | private BshMethod loadScriptedCommand(final InputStream in,
final String name, final Class<?>[] argTypes,
final String resourcePath, final Interpreter interpreter)
throws UtilEvalError {
try (FileReader reader = new FileReader(in)) {
interpreter.eval(reader, this,... | java | {
"resource": ""
} |
q158742 | NameSpace.getClass | train | public Class<?> getClass(final String name) throws UtilEvalError {
final Class<?> c = this.getClassImpl(name);
if (c != null)
return c;
if (this.parent != null)
return this.parent.getClass(name);
return null;
} | java | {
"resource": ""
} |
q158743 | NameSpace.getAllNames | train | public String[] getAllNames() {
final List<String> vec = new ArrayList<String>();
this.getAllNamesAux(vec);
return vec.toArray(new String[vec.size()]);
} | java | {
"resource": ""
} |
q158744 | NameSpace.getAllNamesAux | train | protected void getAllNamesAux(final List<String> vec) {
vec.addAll(this.variables.keySet());
if ( methods != null )
vec.addAll(this.methods.keySet());
if (this.parent != null)
this.parent.getAllNamesAux(vec);
} | java | {
"resource": ""
} |
q158745 | NameSpace.clear | train | public void clear() {
this.variables.clear();
this.methods.clear();
this.importedClasses.clear();
this.importedPackages.clear();
this.importedCommands.clear();
this.importedObjects.clear();
if (this.parent == null)
this.loadDefaultImports();
th... | java | {
"resource": ""
} |
q158746 | NameSpace.importStatic | train | public void importStatic(final Class<?> clas) {
this.importedStatic.remove(clas);
this.importedStatic.add(0, clas);
this.nameSpaceChanged();
} | java | {
"resource": ""
} |
q158747 | NameSpace.getPackage | train | String getPackage() {
if (this.packageName != null)
return this.packageName;
if (this.parent != null)
return this.parent.getPackage();
return null;
} | java | {
"resource": ""
} |
q158748 | NameSpace.attemptSetPropertyValue | train | boolean attemptSetPropertyValue(final String propName, final Object value,
final Interpreter interp) throws UtilEvalError {
final String accessorName = Reflect.accessorName(Reflect.SET_PREFIX, propName);
Object val = Primitive.unwrap(value);
final Class<?>[] classArray = new Class<?>... | java | {
"resource": ""
} |
q158749 | NameSpace.getPropertyValue | train | Object getPropertyValue(final String propName, final Interpreter interp)
throws UtilEvalError {
String accessorName = Reflect.accessorName(Reflect.GET_PREFIX, propName);
final Class<?>[] classArray = Reflect.ZERO_TYPES;
BshMethod m = this.getMethod(accessorName, classArray);
... | java | {
"resource": ""
} |
q158750 | BSHMethodInvocation.eval | train | public Object eval( CallStack callstack, Interpreter interpreter )
throws EvalError
{
NameSpace namespace = callstack.top();
BSHAmbiguousName nameNode = getNameNode();
// get caller info for assert fail
if ("fail".equals(nameNode.text))
interpreter.getNameSpace().setNo... | java | {
"resource": ""
} |
q158751 | ClassGenerator.generateClass | train | public Class<?> generateClass(String name, Modifiers modifiers, Class<?>[] interfaces, Class<?> superClass, BSHBlock block, Type type, CallStack callstack, Interpreter interpreter) throws EvalError {
// Delegate to the static method
return generateClassImpl(name, modifiers, interfaces, superClass, block... | java | {
"resource": ""
} |
q158752 | ClassGenerator.generateClassImpl | train | public static Class<?> generateClassImpl(String name, Modifiers modifiers, Class<?>[] interfaces, Class<?> superClass, BSHBlock block, Type type, CallStack callstack, Interpreter interpreter) throws EvalError {
NameSpace enclosingNameSpace = callstack.top();
String packageName = enclosingNameSpace.getPa... | java | {
"resource": ""
} |
q158753 | Operators.bigIntegerBinaryOperation | train | static Object bigIntegerBinaryOperation(BigInteger lhs, BigInteger rhs, int kind)
{
switch(kind)
{
// arithmetic
case PLUS:
return lhs.add(rhs);
case MINUS:
return lhs.subtract(rhs);
case STAR:
return ... | java | {
"resource": ""
} |
q158754 | Operators.doubleBinaryOperation | train | static Object doubleBinaryOperation(double lhs, double rhs, int kind)
throws UtilEvalError
{
switch(kind)
{
// arithmetic
case PLUS:
if ( lhs > 0d && (Double.MAX_VALUE - lhs) < rhs )
break;
return lhs + rhs;
... | java | {
"resource": ""
} |
q158755 | Operators.promoteToInteger | train | static Number promoteToInteger(Object wrapper )
{
if ( wrapper instanceof Character )
return Integer.valueOf(((Character) wrapper).charValue());
if ( wrapper instanceof Byte || wrapper instanceof Short )
return Integer.valueOf(((Number) wrapper).intValue());
return (... | java | {
"resource": ""
} |
q158756 | SymbolTable.addConstant | train | Symbol addConstant(final Object value) {
if (value instanceof Integer) {
return addConstantInteger(((Integer) value).intValue());
} else if (value instanceof Byte) {
return addConstantInteger(((Byte) value).intValue());
} else if (value instanceof Character) {
return addConstantInteger(((C... | java | {
"resource": ""
} |
q158757 | SymbolTable.addConstantInteger | train | private void addConstantInteger(final int index, final int tag, final int value) {
add(new Entry(index, tag, value, hash(tag, value)));
} | java | {
"resource": ""
} |
q158758 | SymbolTable.addConstantLong | train | private void addConstantLong(final int index, final int tag, final long value) {
add(new Entry(index, tag, value, hash(tag, value)));
} | java | {
"resource": ""
} |
q158759 | SymbolTable.addType | train | int addType(final String value) {
int hashCode = hash(Symbol.TYPE_TAG, value);
Entry entry = get(hashCode);
while (entry != null) {
if (entry.tag == Symbol.TYPE_TAG && entry.hashCode == hashCode && entry.value.equals(value)) {
return entry.index;
}
entry = entry.next;
}
ret... | java | {
"resource": ""
} |
q158760 | BshClassLoader.findClass | train | protected Class findClass( String name )
throws ClassNotFoundException
{
// Deal with this cast somehow... maybe have this class use
// ClassManagerImpl type directly.
// Don't add the method to BshClassManager... it's really an impl thing
ClassManagerImpl bcm = (ClassManager... | java | {
"resource": ""
} |
q158761 | BSHBinaryExpression.getVariableAtNode | train | private Variable getVariableAtNode(int index, CallStack callstack) throws UtilEvalError {
Node nameNode = null;
if (jjtGetChild(index).jjtGetNumChildren() > 0
&& (nameNode = jjtGetChild(index).jjtGetChild(0))
instanceof BSHAmbiguousName)
return callstack.t... | java | {
"resource": ""
} |
q158762 | BSHBinaryExpression.checkNullValues | train | private Object checkNullValues(Object val1, Object val2, int index,
CallStack callstack) throws EvalError {
if ( Primitive.NULL == val1 && Primitive.VOID != val2
&& jjtGetChild(index).jjtGetChild(0)
instanceof BSHAmbiguousName) try {
Variable var = nul... | java | {
"resource": ""
} |
q158763 | BSHBinaryExpression.isWrapper | train | private boolean isWrapper( Class<?> cls ) {
if ( null == cls )
return false;
if ( Boolean.class.isAssignableFrom(cls) ) switch ( kind ) {
case EQ: case NE: case BOOL_OR: case BOOL_ORX: case BOOL_AND:
case BOOL_ANDX: case BIT_AND: case BIT_ANDX: case BIT_OR:
... | java | {
"resource": ""
} |
q158764 | BSHAllocationExpression.arrayFillDefaultValue | train | private void arrayFillDefaultValue(Object arr) {
if (null == arr)
return;
Class<?> clas = arr.getClass();
Class<?> comp = Types.arrayElementType(clas);
if ( !comp.isPrimitive() )
if ( Types.arrayDimensions(clas) > 1 )
for ( int i = 0; i < Array.get... | java | {
"resource": ""
} |
q158765 | Variable.setValue | train | public void setValue( Object value, int context )
throws UtilEvalError
{
// prevent final variable re-assign
if (hasModifier("final")) {
if (this.value != null)
throw new UtilEvalError("Cannot re-assign final variable "+name+".");
if (value == null)
... | java | {
"resource": ""
} |
q158766 | Remote.eval | train | public static int eval( String url, String text )
throws IOException
{
String returnValue = null;
if ( url.startsWith( "http:" ) ) {
returnValue = doHttp( url, text );
} else if ( url.startsWith( "bsh:" ) ) {
returnValue = doBsh( url, text );
} else
... | java | {
"resource": ""
} |
q158767 | SimpleNode.eval | train | public Object eval( CallStack callstack, Interpreter interpreter )
throws EvalError
{
throw new InterpreterError(
"Unimplemented or inappropriate for " + getClass().getName() );
} | java | {
"resource": ""
} |
q158768 | SimpleNode.getText | train | public String getText()
{
StringBuilder text = new StringBuilder();
Token t = firstToken;
while ( t!=null ) {
text.append(t.image);
if ( !t.image.equals(".") )
text.append(" ");
if ( t==lastToken ||
t.image.equals("{") || t.... | java | {
"resource": ""
} |
q158769 | JConsole.actionPerformed | train | public void actionPerformed(ActionEvent event) {
String cmd = event.getActionCommand();
if (cmd.equals(CUT)) {
text.cut();
} else if (cmd.equals(COPY)) {
text.copy();
} else if (cmd.equals(PASTE)) {
text.paste();
}
} | java | {
"resource": ""
} |
q158770 | TypePath.put | train | static void put(final TypePath typePath, final ByteVector output) {
if (typePath == null) {
output.putByte(0);
} else {
int length = typePath.typePathContainer[typePath.typePathOffset] * 2 + 1;
output.putByteArray(typePath.typePathContainer, typePath.typePathOffset, length);
}
} | java | {
"resource": ""
} |
q158771 | Invocable.getParamTypeDescriptors | train | public String [] getParamTypeDescriptors() {
return methodType().parameterList().stream()
.map(BSHType::getTypeDescriptor).toArray(String[]::new);
} | java | {
"resource": ""
} |
q158772 | Invocable.collectParamaters | train | public List<Object> collectParamaters(Object base, Object[] params)
throws Throwable {
parameters.clear();
for (int i = 0; i < getLastParameterIndex(); i++)
parameters.add(coerceToType(params[i], getParameterTypes()[i]));
return parameters;
} | java | {
"resource": ""
} |
q158773 | Invocable.coerceToType | train | protected Object coerceToType(Object param, Class<?> type)
throws Throwable {
if (type != Object.class)
param = Types.castObject(param, type, Types.CAST);
return Primitive.unwrap(param);
} | java | {
"resource": ""
} |
q158774 | Invocable.invokeTarget | train | private synchronized Object invokeTarget(Object base, Object[] pars)
throws Throwable {
Reflect.logInvokeMethod("Invoking method (entry): ", this, pars);
List<Object> params = collectParamaters(base, pars);
Reflect.logInvokeMethod("Invoking method (after): ", this, params);
i... | java | {
"resource": ""
} |
q158775 | Invocable.invoke | train | public synchronized Object invoke(Object base, Object... pars)
throws InvocationTargetException {
if (null == pars)
pars = Reflect.ZERO_ARGS;
try {
return Primitive.wrap(
invokeTarget(base, pars), getReturnType());
}
catch (Throwabl... | java | {
"resource": ""
} |
q158776 | NameCompletionTable.add | train | public void add( NameSource source ) {
/*
Unimplemented -
Need to add an inner class util here that holds the source and
monitors it by registering a listener
*/
if ( sources == null )
sources = new ArrayList();
sources.add( source );
... | java | {
"resource": ""
} |
q158777 | CollectionManager.emptyIt | train | private <T> Iterator<T> emptyIt() {
return new Iterator<T>() {
@Override
public boolean hasNext() {
return false;
}
@Override
public T next() {
return null;
}
};
} | java | {
"resource": ""
} |
q158778 | CollectionManager.arrayIt | train | private Iterator<Object> arrayIt(final Object array) {
return new Iterator<Object>() {
private int index = 0;
private final int length = Array.getLength(array);
@Override
public boolean hasNext() {
return this.index < this.length;
}
... | java | {
"resource": ""
} |
q158779 | CollectionManager.reflectNames | train | private Stream<String> reflectNames(Object obj) {
Class<?> type = obj.getClass();
if (obj instanceof Class<?>)
type = (Class<?>) obj;
if (obj instanceof ClassIdentifier)
type = ((ClassIdentifier)obj).getTargetClass();
if (Reflect.isGeneratedClass(type))
... | java | {
"resource": ""
} |
q158780 | CollectionManager.getBshIterator | train | public <T> Iterator<T> getBshIterator(final Enumeration<T> obj) {
return Collections.list(obj).iterator();
} | java | {
"resource": ""
} |
q158781 | CollectionManager.getBshIterator | train | public Iterator<Integer> getBshIterator(final Number obj) {
int number = obj.intValue();
if (number == 0)
return this.emptyIt();
if (number > 0)
return IntStream.rangeClosed(0, number).iterator();
return IntStream.rangeClosed(number, 0).map(i -> number - i).iterat... | java | {
"resource": ""
} |
q158782 | CollectionManager.getBshIterator | train | public Iterator<String> getBshIterator(final Character obj) {
Integer value = Integer.valueOf(obj.charValue());
int check = 33, start = 0;
for (int i : unicodeBlockStarts) if (check <= value) {
start = check;
check = i;
} else break;
return IntStream.range... | java | {
"resource": ""
} |
q158783 | CollectionManager.getBshIterator | train | public Iterator<?> getBshIterator(final Object obj) {
if (obj == null)
return this.emptyIt();
if (obj instanceof Primitive)
return this.getBshIterator(Primitive.unwrap(obj));
if (obj.getClass().isArray())
return this.arrayIt(obj);
if (obj instanceof It... | java | {
"resource": ""
} |
q158784 | TargetError.printTargetError | train | private synchronized String printTargetError( Throwable t ) {
StringBuilder msgs = new StringBuilder(t.toString());
while ( null != (t = t.getCause()) )
msgs.append("\n").append(t.toString());
return msgs.toString();
} | java | {
"resource": ""
} |
q158785 | EvalError.getMessage | train | public String getMessage()
{
String trace;
if ( node != null )
trace = " : at Line: "+ node.getLineNumber()
+ " : in file: "+ node.getSourceFile()
+ " : "+node.getText();
else
// Users should not normally see this.
trace = "... | java | {
"resource": ""
} |
q158786 | EvalError.prependMessage | train | private void prependMessage( String s )
{
if ( s == null )
return;
if ( message == null )
message = s;
else
message = s + " : "+ message;
} | java | {
"resource": ""
} |
q158787 | SimpleTemplate.replace | train | public void replace( String param, String value ) {
int [] range;
while ( (range = findTemplate( param )) != null )
buff.replace( range[0], range[1], value );
} | java | {
"resource": ""
} |
q158788 | BlockNameSpace.getNonBlockParent | train | private NameSpace getNonBlockParent()
{
NameSpace parent = super.getParent();
if ( parent instanceof BlockNameSpace )
return ((BlockNameSpace)parent).getNonBlockParent();
else
return parent;
} | java | {
"resource": ""
} |
q158789 | BSHFormalParameter.eval | train | public Object eval( CallStack callstack, Interpreter interpreter)
throws EvalError
{
if ( jjtGetNumChildren() > 0 )
type = ((BSHType)jjtGetChild(0)).getType( callstack, interpreter );
else
type = UNTYPED;
if (isVarArgs)
type = Array.newInstance(ty... | java | {
"resource": ""
} |
q158790 | UtilEvalError.toEvalError | train | public EvalError toEvalError(
String msg, SimpleNode node, CallStack callstack )
{
if ( Interpreter.DEBUG.get() )
printStackTrace();
if ( msg == null )
msg = "";
else
msg += ": ";
return new EvalError( msg + this.getMessage(), node, calls... | java | {
"resource": ""
} |
q158791 | StringUtil.typeString | train | public static String typeString(Object value) {
return null == value || Primitive.NULL == value
? "null"
: value instanceof Primitive
? ((Primitive) value).getType().getSimpleName()
: typeString(value.getClass());
} | java | {
"resource": ""
} |
q158792 | StringUtil.typeString | train | public static String typeString(Class<?> clas) {
if (Map.class.isAssignableFrom(clas))
clas = Map.class;
else if (List.class.isAssignableFrom(clas))
if (Queue.class.isAssignableFrom(clas))
clas = Queue.class;
else
clas = List.class;
... | java | {
"resource": ""
} |
q158793 | StringUtil.typeValueString | train | public static String typeValueString(final Object value) {
StringBuilder sb = new StringBuilder(valueString(value));
return sb.append(" :").append(typeString(value)).toString();
} | java | {
"resource": ""
} |
q158794 | BSHPrimarySuffix.doProperty | train | private Object doProperty( boolean toLHS,
Object obj, CallStack callstack, Interpreter interpreter )
throws EvalError
{
if(obj == Primitive.VOID)
throw new EvalError(
"Attempt to access property on undefined variable or class name",
this, callstack );
... | java | {
"resource": ""
} |
q158795 | LHS.writeObject | train | private synchronized void writeObject(final ObjectOutputStream s) throws IOException {
if ( null != field ) {
this.object = field.getDeclaringClass();
this.varName = field.getName();
this.field = null;
}
s.defaultWriteObject();
} | java | {
"resource": ""
} |
q158796 | LHS.readObject | train | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
if ( null == this.object )
return;
Class<?> cls = this.object.getClass();
if ( this.object instanceof Class )
cls = (Class<?>) this.object;
t... | java | {
"resource": ""
} |
q158797 | BshArray.getIndex | train | public static Object getIndex(Object array, int index)
throws UtilTargetError {
Interpreter.debug("getIndex: ", array, ", index=", index);
try {
if ( array instanceof List )
return ((List<?>) array).get(index);
Object val = Array.get(array, index);
... | java | {
"resource": ""
} |
q158798 | BshArray.setIndex | train | @SuppressWarnings("unchecked")
public static void setIndex(Object array, int index, Object val)
throws ReflectError, UtilTargetError {
try {
val = Primitive.unwrap(val);
if ( array instanceof List )
((List<Object>) array).set(index, val);
else
... | java | {
"resource": ""
} |
q158799 | BshArray.slice | train | public static Object slice(List<Object> list, int from, int to, int step) {
int length = list.size();
if ( to > length ) to = length;
if ( 0 > from ) from = 0;
length = to - from;
if ( 0 >= length )
return list.subList(0, 0);
if ( step == 0 || step == 1 )
... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.