rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
| meta
stringlengths 141
403
|
---|---|---|---|
if (status != null && status.indexOf("phone") != -1) { | if (status != null && status.toLowerCase().indexOf("phone") != -1) { | public void updatePresenceIcon(Presence presence) { ChatManager chatManager = SparkManager.getChatManager(); boolean handled = chatManager.fireContactItemPresenceChanged(this, presence); if (handled) { return; } String status = presence != null ? presence.getStatus() : null; Icon statusIcon = SparkRes.getImageIcon(SparkRes.GREEN_BALL); boolean isAvailable = false; if (status == null && presence != null) { Presence.Mode mode = presence.getMode(); if (mode == Presence.Mode.available) { status = "Available"; isAvailable = true; } else if (mode == Presence.Mode.away) { status = "I'm away"; statusIcon = SparkRes.getImageIcon(SparkRes.IM_AWAY); } else if (mode == Presence.Mode.chat) { status = "I'm free to chat"; } else if (mode == Presence.Mode.dnd) { status = "Do not disturb"; statusIcon = SparkRes.getImageIcon(SparkRes.IM_AWAY); } else if (mode == Presence.Mode.xa) { status = "Extended away"; statusIcon = SparkRes.getImageIcon(SparkRes.IM_AWAY); } } else if (presence != null && (presence.getMode() == Presence.Mode.dnd || presence.getMode() == Presence.Mode.away || presence.getMode() == Presence.Mode.xa)) { statusIcon = SparkRes.getImageIcon(SparkRes.IM_AWAY); } else if (presence != null && presence.getType() == Presence.Type.available) { isAvailable = true; } else if (presence == null) { getNicknameLabel().setFont(new Font("Dialog", Font.PLAIN, 11)); getNicknameLabel().setForeground((Color)UIManager.get("ContactItemOffline.color")); RosterEntry entry = SparkManager.getConnection().getRoster().getEntry(getFullJID()); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { // Do not move out of group. setIcon(SparkRes.getImageIcon(SparkRes.SMALL_QUESTION)); getNicknameLabel().setFont(new Font("Dialog", Font.PLAIN, 11)); setStatusText("Pending"); } else { setIcon(null); setFont(new Font("Dialog", Font.PLAIN, 11)); getNicknameLabel().setFont(new Font("Dialog", Font.PLAIN, 11)); setAvailable(false); setStatusText(""); } sideIcon.setIcon(null); setAvailable(false); return; } StatusItem statusItem = SparkManager.getWorkspace().getStatusBar().getItemFromPresence(presence); if (statusItem != null) { setIcon(statusItem.getIcon()); } else { setIcon(statusIcon); } if (status != null) { setStatus(status); } if (status != null && status.indexOf("phone") != -1) { statusIcon = SparkRes.getImageIcon(SparkRes.ON_PHONE_IMAGE); setIcon(statusIcon); } // Always change nickname label to black. getNicknameLabel().setForeground((Color)UIManager.get("ContactItemNickname.foreground")); if (isAvailable) { getNicknameLabel().setFont(new Font("Dialog", Font.PLAIN, 11)); if ("Online".equals(status) || "Available".equalsIgnoreCase(status)) { setStatusText(""); } else { setStatusText(status); } } else if (presence != null) { getNicknameLabel().setFont(new Font("Dialog", Font.ITALIC, 11)); getNicknameLabel().setForeground(Color.gray); if (status != null) { setStatusText(status); } } setAvailable(true); } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/fea468feedc212a5d28808907b5dfa7da841d129/ContactItem.java/buggy/src/java/org/jivesoftware/spark/ui/ContactItem.java |
if(numDays > 0){ buf.append(numDays + " d, "); } | public static String getTimeFromLong(long diff) { final String HOURS = "h"; final String MINUTES = "min"; final String SECONDS = "sec"; final long MS_IN_A_DAY = 1000 * 60 * 60 * 24; final long MS_IN_AN_HOUR = 1000 * 60 * 60; final long MS_IN_A_MINUTE = 1000 * 60; final long MS_IN_A_SECOND = 1000; Date currentTime = new Date(); long numDays = diff / MS_IN_A_DAY; diff = diff % MS_IN_A_DAY; long numHours = diff / MS_IN_AN_HOUR; diff = diff % MS_IN_AN_HOUR; long numMinutes = diff / MS_IN_A_MINUTE; diff = diff % MS_IN_A_MINUTE; long numSeconds = diff / MS_IN_A_SECOND; diff = diff % MS_IN_A_SECOND; long numMilliseconds = diff; StringBuffer buf = new StringBuffer(); if (numHours > 0) { buf.append(numHours + " " + HOURS + ", "); } if (numMinutes > 0) { buf.append(numMinutes + " " + MINUTES); } //buf.append(numSeconds + " " + SECONDS); String result = buf.toString(); if (numMinutes < 1) { result = "< 1 minute"; } return result; } | 52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/8c2e49a168742b82792a128852416dd3a9165454/ModelUtil.java/buggy/src/java/org/jivesoftware/spark/util/ModelUtil.java |
|
public List findAll(final Class klass, final Filter filter) | public <T extends IObject> List<T> findAll(final Class<T> klass, final Filter filter) | public List findAll(final Class klass, final Filter filter) { if ( filter == null ) return getHibernateTemplate().loadAll( klass ); return (List) getHibernateTemplate().execute( new HibernateCallback(){ public Object doInHibernate(Session session) throws HibernateException, SQLException { Criteria c = session.createCriteria(klass); parseFilter( c,filter ); return c.list(); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
return (List) getHibernateTemplate().execute( new HibernateCallback(){ | return (List<T>) getHibernateTemplate().execute( new HibernateCallback(){ | public List findAll(final Class klass, final Filter filter) { if ( filter == null ) return getHibernateTemplate().loadAll( klass ); return (List) getHibernateTemplate().execute( new HibernateCallback(){ public Object doInHibernate(Session session) throws HibernateException, SQLException { Criteria c = session.createCriteria(klass); parseFilter( c,filter ); return c.list(); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
public List findAllByExample(final IObject example, final Filter filter) | public <T extends IObject> List<T> findAllByExample(final T example, final Filter filter) | public List findAllByExample(final IObject example, final Filter filter) { return (List) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Criteria c = session.createCriteria(example.getClass()); c.add(Example.create(example)); parseFilter(c,filter); return c.list(); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
return (List) getHibernateTemplate().execute(new HibernateCallback() { | return (List<T>) getHibernateTemplate().execute(new HibernateCallback() { | public List findAllByExample(final IObject example, final Filter filter) { return (List) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Criteria c = session.createCriteria(example.getClass()); c.add(Example.create(example)); parseFilter(c,filter); return c.list(); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
public List findAllByQuery(String queryName, Parameters params) | public <T extends IObject> List<T> findAllByQuery(String queryName, Parameters params) | public List findAllByQuery(String queryName, Parameters params) { Query<List> q = queryFactory.lookup( queryName, params ); return execute(q); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
Query<List> q = queryFactory.lookup( queryName, params ); | Query<List<T>> q = queryFactory.lookup( queryName, params ); | public List findAllByQuery(String queryName, Parameters params) { Query<List> q = queryFactory.lookup( queryName, params ); return execute(q); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
public List findAllByString( final Class klass, | public <T extends IObject> List<T> findAllByString( final Class<T> klass, | public List findAllByString( final Class klass, final String fieldName, final String value, final boolean caseSensitive, final Filter filter) throws ApiUsageException { return (List) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Criteria c = session.createCriteria(klass); parseFilter( c,filter ); if (caseSensitive) c.add(Expression.like(fieldName,value,MatchMode.ANYWHERE)); else c.add(Expression.ilike(fieldName,value,MatchMode.ANYWHERE)); return c.list(); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
return (List) getHibernateTemplate().execute(new HibernateCallback() { | return (List<T>) getHibernateTemplate().execute(new HibernateCallback() { | public List findAllByString( final Class klass, final String fieldName, final String value, final boolean caseSensitive, final Filter filter) throws ApiUsageException { return (List) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Criteria c = session.createCriteria(klass); parseFilter( c,filter ); if (caseSensitive) c.add(Expression.like(fieldName,value,MatchMode.ANYWHERE)); else c.add(Expression.ilike(fieldName,value,MatchMode.ANYWHERE)); return c.list(); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
public IObject findByExample(final IObject example) throws ApiUsageException | public <T extends IObject> T findByExample(final T example) throws ApiUsageException | public IObject findByExample(final IObject example) throws ApiUsageException { return (IObject) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Criteria c = session.createCriteria(example.getClass()); c.add(Example.create(example)); return c.uniqueResult(); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
return (IObject) getHibernateTemplate().execute(new HibernateCallback() { | return (T) getHibernateTemplate().execute(new HibernateCallback() { | public IObject findByExample(final IObject example) throws ApiUsageException { return (IObject) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Criteria c = session.createCriteria(example.getClass()); c.add(Example.create(example)); return c.uniqueResult(); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
public IObject findByQuery(String queryName, Parameters params) | public <T extends IObject> T findByQuery(String queryName, Parameters params) | public IObject findByQuery(String queryName, Parameters params) throws ValidationException { if ( params == null ) { params = new Parameters(); } // specify that we should only return a single value if possible params.getFilter().unique(); Query<IObject> q = queryFactory.lookup( queryName, params ); IObject result = null; try { result = execute(q); } catch (ClassCastException cce) { throw new ApiUsageException( "Query named:\n\t"+queryName+"\n" + "has returned an Object of type "+cce.getMessage()+"\n" + "Queries must return IObjects when using findByQuery. \n" + "Please try findAllByQuery for queries which return Lists." ); } catch (NonUniqueResultException nure) { throw new ApiUsageException( "Query named:\n\t"+queryName+"\n" + "has returned more than one Object\n" + "findByQuery must return a single value.\n" + "Please try findAllByQuery for queries which return Lists." ); } return result; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
Query<IObject> q = queryFactory.lookup( queryName, params ); IObject result = null; | Query<T> q = queryFactory.lookup( queryName, params ); T result = null; | public IObject findByQuery(String queryName, Parameters params) throws ValidationException { if ( params == null ) { params = new Parameters(); } // specify that we should only return a single value if possible params.getFilter().unique(); Query<IObject> q = queryFactory.lookup( queryName, params ); IObject result = null; try { result = execute(q); } catch (ClassCastException cce) { throw new ApiUsageException( "Query named:\n\t"+queryName+"\n" + "has returned an Object of type "+cce.getMessage()+"\n" + "Queries must return IObjects when using findByQuery. \n" + "Please try findAllByQuery for queries which return Lists." ); } catch (NonUniqueResultException nure) { throw new ApiUsageException( "Query named:\n\t"+queryName+"\n" + "has returned more than one Object\n" + "findByQuery must return a single value.\n" + "Please try findAllByQuery for queries which return Lists." ); } return result; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
public IObject findByString( final Class klass, | public <T extends IObject> T findByString( final Class<T> klass, | public IObject findByString( final Class klass, final String fieldName, final String value) throws ApiUsageException { return (IObject) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Criteria c = session.createCriteria(klass); c.add(Expression.like(fieldName,value)); return c.uniqueResult(); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
return (IObject) getHibernateTemplate().execute(new HibernateCallback() { | return (T) getHibernateTemplate().execute(new HibernateCallback() { | public IObject findByString( final Class klass, final String fieldName, final String value) throws ApiUsageException { return (IObject) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Criteria c = session.createCriteria(klass); c.add(Expression.like(fieldName,value)); return c.uniqueResult(); } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/dc8dde051a1e2b716514b3964c9222ce006ebea9/QueryImpl.java/buggy/components/server/src/ome/logic/QueryImpl.java |
throw runtime.newNameError("Superclass method '" + context.getFrameLastFunc() + "' disabled."); | String name = context.getFrameLastFunc(); throw runtime.newNameError("Superclass method '" + name + "' disabled.", name); | private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyObject self) { IRuby runtime = context.getRuntime(); bigloop: do { if (node == null) return runtime.getNil(); switch (node.nodeId) { case NodeTypes.ALIASNODE: { AliasNode iVisited = (AliasNode) node; if (context.getRubyClass() == null) { throw runtime.newTypeError("no class to make alias"); } context.getRubyClass().defineAlias(iVisited.getNewName(), iVisited.getOldName()); context.getRubyClass().callMethod(context, "method_added", runtime.newSymbol(iVisited.getNewName())); return runtime.getNil(); } case NodeTypes.ANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.ARGSCATNODE: { ArgsCatNode iVisited = (ArgsCatNode) node; IRubyObject args = evalInternal(context, iVisited.getFirstNode(), self); IRubyObject secondArgs = splatValue(evalInternal(context, iVisited.getSecondNode(), self)); RubyArray list = args instanceof RubyArray ? (RubyArray) args : runtime.newArray(args); return list.concat(secondArgs); } // case NodeTypes.ARGSNODE: // EvaluateVisitor.argsNodeVisitor.execute(this, node); // break; // case NodeTypes.ARGUMENTNODE: // EvaluateVisitor.argumentNodeVisitor.execute(this, node); // break; case NodeTypes.ARRAYNODE: { ArrayNode iVisited = (ArrayNode) node; IRubyObject[] array = new IRubyObject[iVisited.size()]; int i = 0; for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node next = (Node) iterator.next(); array[i++] = evalInternal(context, next, self); } return runtime.newArray(array); } // case NodeTypes.ASSIGNABLENODE: // EvaluateVisitor.assignableNodeVisitor.execute(this, node); // break; case NodeTypes.BACKREFNODE: { BackRefNode iVisited = (BackRefNode) node; IRubyObject backref = context.getBackref(); switch (iVisited.getType()) { case '~': return backref; case '&': return RubyRegexp.last_match(backref); case '`': return RubyRegexp.match_pre(backref); case '\'': return RubyRegexp.match_post(backref); case '+': return RubyRegexp.match_last(backref); } break; } case NodeTypes.BEGINNODE: { BeginNode iVisited = (BeginNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.BIGNUMNODE: { BignumNode iVisited = (BignumNode) node; return RubyBignum.newBignum(runtime, iVisited.getValue()); } // case NodeTypes.BINARYOPERATORNODE: // EvaluateVisitor.binaryOperatorNodeVisitor.execute(this, node); // break; // case NodeTypes.BLOCKARGNODE: // EvaluateVisitor.blockArgNodeVisitor.execute(this, node); // break; case NodeTypes.BLOCKNODE: { BlockNode iVisited = (BlockNode) node; IRubyObject result = runtime.getNil(); for (Iterator iter = iVisited.iterator(); iter.hasNext();) { result = evalInternal(context, (Node) iter.next(), self); } return result; } case NodeTypes.BLOCKPASSNODE: { BlockPassNode iVisited = (BlockPassNode) node; IRubyObject proc = evalInternal(context, iVisited.getBodyNode(), self); if (proc.isNil()) { context.setNoBlock(); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearNoBlock(); } } // If not already a proc then we should try and make it one. if (!(proc instanceof RubyProc)) { proc = proc.convertToType("Proc", "to_proc", false); if (!(proc instanceof RubyProc)) { throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)"); } } // TODO: Add safety check for taintedness Block block = (Block) context.getCurrentBlock(); if (block != null) { IRubyObject blockObject = block.getBlockObject(); // The current block is already associated with the proc. No need to create new // block for it. Just eval! if (blockObject != null && blockObject == proc) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearBlockAvailable(); } } } context.preBlockPassEval(((RubyProc) proc).getBlock()); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.postBlockPassEval(); } } case NodeTypes.BREAKNODE: { BreakNode iVisited = (BreakNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.BreakJump); je.setPrimaryData(result); je.setSecondaryData(node); throw je; } case NodeTypes.CALLNODE: { CallNode iVisited = (CallNode) node; context.beginCallArgs(); IRubyObject receiver = null; IRubyObject[] args = null; try { receiver = evalInternal(context, iVisited.getReceiverNode(), self); args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } assert receiver.getMetaClass() != null : receiver.getClass().getName(); // If reciever is self then we do the call the same way as vcall CallType callType = (receiver == self ? CallType.VARIABLE : CallType.NORMAL); return receiver.callMethod(context, iVisited.getName(), args, callType); } case NodeTypes.CASENODE: { CaseNode iVisited = (CaseNode) node; IRubyObject expression = null; if (iVisited.getCaseNode() != null) { expression = evalInternal(context, iVisited.getCaseNode(), self); } context.pollThreadEvents(); IRubyObject result = runtime.getNil(); Node firstWhenNode = iVisited.getFirstWhenNode(); while (firstWhenNode != null) { if (!(firstWhenNode instanceof WhenNode)) { node = firstWhenNode; continue bigloop; } WhenNode whenNode = (WhenNode) firstWhenNode; if (whenNode.getExpressionNodes() instanceof ArrayNode) { for (Iterator iter = ((ArrayNode) whenNode.getExpressionNodes()).iterator(); iter .hasNext();) { Node tag = (Node) iter.next(); context.setPosition(tag.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // Ruby grammar has nested whens in a case body because of // productions case_body and when_args. if (tag instanceof WhenNode) { RubyArray expressions = (RubyArray) evalInternal(context, ((WhenNode) tag) .getExpressionNodes(), self); for (int j = 0; j < expressions.getLength(); j++) { IRubyObject condition = expressions.entry(j); if ((expression != null && condition.callMethod(context, "===", expression) .isTrue()) || (expression == null && condition.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } continue; } result = evalInternal(context, tag, self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = whenNode.getBodyNode(); continue bigloop; } } } else { result = evalInternal(context, whenNode.getExpressionNodes(), self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } context.pollThreadEvents(); firstWhenNode = whenNode.getNextCase(); } return runtime.getNil(); } case NodeTypes.CLASSNODE: { ClassNode iVisited = (ClassNode) node; Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self); Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingClass = getEnclosingModule(context, classNameNode, self); RubyClass rubyClass = enclosingClass.defineOrGetClassUnder(name, superClass); if (context.getWrapper() != null) { rubyClass.extendObject(context.getWrapper()); rubyClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self); } case NodeTypes.CLASSVARASGNNODE: { ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__"); } rubyClass.setClassVar(iVisited.getName(), result); return result; } case NodeTypes.CLASSVARDECLNODE: { ClassVarDeclNode iVisited = (ClassVarDeclNode) node; // FIXME: shouldn't we use cref here? if (context.getRubyClass() == null) { throw runtime.newTypeError("no class/module to define class variable"); } IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); ((RubyModule) context.peekCRef().getValue()).setClassVar(iVisited.getName(), result); return runtime.getNil(); } case NodeTypes.CLASSVARNODE: { ClassVarNode iVisited = (ClassVarNode) node; RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule)rubyClass.getInstanceVariable("__attached__"); } return rubyClass.getClassVar(iVisited.getName()); } case NodeTypes.COLON2NODE: { Colon2Node iVisited = (Colon2Node) node; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { return runtime.getObject().getConstantFrom(iVisited.getName()); } else { IRubyObject result = evalInternal(context, iVisited.getLeftNode(), self); if (result instanceof RubyModule) { return ((RubyModule) result).getConstantFrom(iVisited.getName()); } else { return result.callMethod(context, iVisited.getName()); } } } case NodeTypes.COLON3NODE: { Colon3Node iVisited = (Colon3Node) node; return runtime.getObject().getConstantFrom(iVisited.getName()); } case NodeTypes.CONSTDECLNODE: { ConstDeclNode iVisited = (ConstDeclNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); IRubyObject module; if (iVisited.getPathNode() != null) { module = evalInternal(context, iVisited.getPathNode(), self); } else { // FIXME: why do we check RubyClass and then use CRef? if (context.getRubyClass() == null) { // TODO: wire into new exception handling mechanism throw runtime.newTypeError("no class/module to define constant"); } module = (RubyModule) context.peekCRef().getValue(); } // FIXME: shouldn't we use the result of this set in setResult? ((RubyModule) module).setConstant(iVisited.getName(), result); return result; } case NodeTypes.CONSTNODE: { ConstNode iVisited = (ConstNode) node; return context.getConstant(iVisited.getName()); } case NodeTypes.DASGNNODE: { DAsgnNode iVisited = (DAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("DSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.DEFINEDNODE: { DefinedNode iVisited = (DefinedNode) node; String definition = getDefinition(context, iVisited.getExpressionNode(), self); if (definition != null) { return runtime.newString(definition); } else { return runtime.getNil(); } } case NodeTypes.DEFNNODE: { DefnNode iVisited = (DefnNode) node; RubyModule containingClass = context.getRubyClass(); if (containingClass == null) { throw runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = context.getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod( name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass) containingClass).getAttachedObject().callMethod( context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod(context, "method_added", runtime.newSymbol(name)); } return runtime.getNil(); } case NodeTypes.DEFSNODE: { DefsNode iVisited = (DefsNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } if (!receiver.singletonMethodsAllowed()) { throw runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } RubyClass rubyClass = receiver.getSingletonClass(); if (runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); return runtime.getNil(); } case NodeTypes.DOTNODE: { DotNode iVisited = (DotNode) node; return RubyRange.newRange(runtime, evalInternal(context, iVisited.getBeginNode(), self), evalInternal(context, iVisited .getEndNode(), self), iVisited.isExclusive()); } case NodeTypes.DREGEXPNODE: { DRegexpNode iVisited = (DRegexpNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), lang); } case NodeTypes.DSTRNODE: { DStrNode iVisited = (DStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newString(sb.toString()); } case NodeTypes.DSYMBOLNODE: { DSymbolNode iVisited = (DSymbolNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.getNode().iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newSymbol(sb.toString()); } case NodeTypes.DVARNODE: { DVarNode iVisited = (DVarNode) node; // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; } case NodeTypes.DXSTRNODE: { DXStrNode iVisited = (DXStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return self.callMethod(context, "`", runtime.newString(sb.toString())); } case NodeTypes.ENSURENODE: { EnsureNode iVisited = (EnsureNode) node; // save entering the try if there's nothing to ensure if (iVisited.getEnsureNode() != null) { IRubyObject result = runtime.getNil(); try { result = evalInternal(context, iVisited.getBodyNode(), self); } finally { evalInternal(context, iVisited.getEnsureNode(), self); } return result; } node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.EVSTRNODE: { EvStrNode iVisited = (EvStrNode) node; node = iVisited.getBody(); continue bigloop; } case NodeTypes.FALSENODE: { context.pollThreadEvents(); return runtime.getFalse(); } case NodeTypes.FCALLNODE: { FCallNode iVisited = (FCallNode) node; context.beginCallArgs(); IRubyObject[] args; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return runtime.newFixnum(iVisited.getValue()); } case NodeTypes.FLIPNODE: { FlipNode iVisited = (FlipNode) node; IRubyObject result = runtime.getNil(); if (iVisited.isExclusive()) { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { result = evalInternal(context, iVisited.getBeginNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } else { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { if (evalInternal(context, iVisited.getBeginNode(), self).isTrue()) { context.getCurrentScope().setValue( iVisited.getIndex(), evalInternal(context, iVisited.getEndNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(), iVisited.getDepth()); return runtime.getTrue(); } else { return runtime.getFalse(); } } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } } case NodeTypes.FLOATNODE: { FloatNode iVisited = (FloatNode) node; return RubyFloat.newFloat(runtime, iVisited.getValue()); } case NodeTypes.FORNODE: { ForNode iVisited = (ForNode) node; // For nodes do not have to create an addition scope so we just pass null context.preForLoopEval(Block.createBlock(iVisited.getVarNode(), null, iVisited.getCallable(), self)); try { while (true) { try { ISourcePosition position = context.getPosition(); context.beginCallArgs(); IRubyObject recv = null; try { recv = evalInternal(context, iVisited.getIterNode(), self); } finally { context.setPosition(position); context.endCallArgs(); } return recv.callMethod(context, "each", IRubyObject.NULL_ARRAY, CallType.NORMAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // do nothing, allow loop to retry break; default: throw je; } } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postForLoopEval(); } } case NodeTypes.GLOBALASGNNODE: { GlobalAsgnNode iVisited = (GlobalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); runtime.getGlobalVariables().set(iVisited.getName(), result); return result; } case NodeTypes.GLOBALVARNODE: { GlobalVarNode iVisited = (GlobalVarNode) node; return runtime.getGlobalVariables().get(iVisited.getName()); } case NodeTypes.HASHNODE: { HashNode iVisited = (HashNode) node; Map hash = null; if (iVisited.getListNode() != null) { hash = new HashMap(iVisited.getListNode().size() / 2); for (Iterator iterator = iVisited.getListNode().iterator(); iterator.hasNext();) { // insert all nodes in sequence, hash them in the final instruction // KEY IRubyObject key = evalInternal(context, (Node) iterator.next(), self); IRubyObject value = evalInternal(context, (Node) iterator.next(), self); hash.put(key, value); } } if (hash == null) { return RubyHash.newHash(runtime); } return RubyHash.newHash(runtime, hash, runtime.getNil()); } case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; IRubyObject result = evalInternal(context, iVisited.getCondition(), self); if (result.isTrue()) { node = iVisited.getThenBody(); continue bigloop; } else { node = iVisited.getElseBody(); continue bigloop; } } case NodeTypes.INSTASGNNODE: { InstAsgnNode iVisited = (InstAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); self.setInstanceVariable(iVisited.getName(), result); return result; } case NodeTypes.INSTVARNODE: { InstVarNode iVisited = (InstVarNode) node; IRubyObject variable = self.getInstanceVariable(iVisited.getName()); return variable == null ? runtime.getNil() : variable; } // case NodeTypes.ISCOPINGNODE: // EvaluateVisitor.iScopingNodeVisitor.execute(this, node); // break; case NodeTypes.ITERNODE: { IterNode iVisited = (IterNode) node; context.preIterEval(Block.createBlock(iVisited.getVarNode(), new DynamicScope(iVisited.getScope(), context.getCurrentScope()), iVisited.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.LOCALASGNNODE: { LocalAsgnNode iVisited = (LocalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("LSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.LOCALVARNODE: { LocalVarNode iVisited = (LocalVarNode) node; //System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); return result == null ? runtime.getNil() : result; } case NodeTypes.MATCH2NODE: { Match2Node iVisited = (Match2Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); return ((RubyRegexp) recv).match(value); } case NodeTypes.MATCH3NODE: { Match3Node iVisited = (Match3Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); if (value instanceof RubyString) { return ((RubyRegexp) recv).match(value); } else { return value.callMethod(context, "=~", recv); } } case NodeTypes.MATCHNODE: { MatchNode iVisited = (MatchNode) node; return ((RubyRegexp) evalInternal(context, iVisited.getRegexpNode(), self)).match2(); } case NodeTypes.MODULENODE: { ModuleNode iVisited = (ModuleNode) node; Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingModule = getEnclosingModule(context, classNameNode, self); if (enclosingModule == null) { throw runtime.newTypeError("no outer class/module"); } RubyModule module; if (enclosingModule == runtime.getObject()) { module = runtime.getOrCreateModule(name); } else { module = enclosingModule.defineModuleUnder(name); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self); } case NodeTypes.MULTIPLEASGNNODE: { MultipleAsgnNode iVisited = (MultipleAsgnNode) node; return AssignmentVisitor.assign(context, self, iVisited, evalInternal(context, iVisited.getValueNode(), self), false); } case NodeTypes.NEWLINENODE: { NewlineNode iVisited = (NewlineNode) node; // something in here is used to build up ruby stack trace... context.setPosition(iVisited.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // TODO: do above but not below for additional newline nodes node = iVisited.getNextNode(); continue bigloop; } case NodeTypes.NEXTNODE: { NextNode iVisited = (NextNode) node; context.pollThreadEvents(); IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.NextJump); je.setPrimaryData(result); je.setSecondaryData(iVisited); //state.setCurrentException(je); throw je; } case NodeTypes.NILNODE: return runtime.getNil(); case NodeTypes.NOTNODE: { NotNode iVisited = (NotNode) node; IRubyObject result = evalInternal(context, iVisited.getConditionNode(), self); return result.isTrue() ? runtime.getFalse() : runtime.getTrue(); } case NodeTypes.NTHREFNODE: { NthRefNode iVisited = (NthRefNode) node; return RubyRegexp.nth_match(iVisited.getMatchNumber(), context.getBackref()); } case NodeTypes.OPASGNANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; // add in reverse order IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.OPASGNNODE: { OpAsgnNode iVisited = (OpAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = receiver.callMethod(context, iVisited.getVariableName()); if (iVisited.getOperatorName().equals("||")) { if (value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else { value = value.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited.getValueNode(), self)); } receiver.callMethod(context, iVisited.getVariableName() + "=", value); context.pollThreadEvents(); return value; } case NodeTypes.OPASGNORNODE: { OpAsgnOrNode iVisited = (OpAsgnOrNode) node; String def = getDefinition(context, iVisited.getFirstNode(), self); IRubyObject result = runtime.getNil(); if (def != null) { result = evalInternal(context, iVisited.getFirstNode(), self); } if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } case NodeTypes.OPELEMENTASGNNODE: { OpElementAsgnNode iVisited = (OpElementAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); IRubyObject firstValue = receiver.callMethod(context, "[]", args); if (iVisited.getOperatorName().equals("||")) { if (firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else { firstValue = firstValue.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited .getValueNode(), self)); } IRubyObject[] expandedArgs = new IRubyObject[args.length + 1]; System.arraycopy(args, 0, expandedArgs, 0, args.length); expandedArgs[expandedArgs.length - 1] = firstValue; return receiver.callMethod(context, "[]=", expandedArgs); } case NodeTypes.OPTNNODE: { OptNNode iVisited = (OptNNode) node; IRubyObject result = runtime.getNil(); while (RubyKernel.gets(runtime.getTopSelf(), IRubyObject.NULL_ARRAY).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: // do nothing, this iteration restarts break; case JumpType.NEXT: // recheck condition break loop; case JumpType.BREAK: // end loop return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.ORNODE: { OrNode iVisited = (OrNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } // case NodeTypes.POSTEXENODE: // EvaluateVisitor.postExeNodeVisitor.execute(this, node); // break; case NodeTypes.REDONODE: { context.pollThreadEvents(); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.RedoJump); je.setSecondaryData(node); throw je; } case NodeTypes.REGEXPNODE: { RegexpNode iVisited = (RegexpNode) node; String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), lang); } case NodeTypes.RESCUEBODYNODE: { RescueBodyNode iVisited = (RescueBodyNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.RESCUENODE: { RescueNode iVisited = (RescueNode)node; RescuedBlock : while (true) { try { // Execute rescue block IRubyObject result = evalInternal(context, iVisited.getBodyNode(), self); // If no exception is thrown execute else block if (iVisited.getElseNode() != null) { if (iVisited.getRescueNode() == null) { runtime.getWarnings().warn(iVisited.getElseNode().getPosition(), "else without rescue is useless"); } result = evalInternal(context, iVisited.getElseNode(), self); } return result; } catch (RaiseException raiseJump) { RubyException raisedException = raiseJump.getException(); // TODO: Rubicon TestKernel dies without this line. A cursory glance implies we // falsely set $! to nil and this sets it back to something valid. This should // get fixed at the same time we address bug #1296484. runtime.getGlobalVariables().set("$!", raisedException); RescueBodyNode rescueNode = iVisited.getRescueNode(); while (rescueNode != null) { Node exceptionNodes = rescueNode.getExceptionNodes(); ListNode exceptionNodesList; if (exceptionNodes instanceof SplatNode) { exceptionNodesList = (ListNode) evalInternal(context, exceptionNodes, self); } else { exceptionNodesList = (ListNode) exceptionNodes; } if (isRescueHandled(context, raisedException, exceptionNodesList, self)) { try { return evalInternal(context, rescueNode, self); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.RetryJump) { // should be handled in the finally block below //state.runtime.getGlobalVariables().set("$!", state.runtime.getNil()); //state.threadContext.setRaisedException(null); continue RescuedBlock; } else { throw je; } } } rescueNode = rescueNode.getOptRescueNode(); } // no takers; bubble up throw raiseJump; } finally { // clear exception when handled or retried runtime.getGlobalVariables().set("$!", runtime.getNil()); } } } case NodeTypes.RETRYNODE: { context.pollThreadEvents(); JumpException je = new JumpException(JumpException.JumpType.RetryJump); throw je; } case NodeTypes.RETURNNODE: { ReturnNode iVisited = (ReturnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.ReturnJump); je.setPrimaryData(iVisited.getTarget()); je.setSecondaryData(result); je.setTertiaryData(iVisited); throw je; } case NodeTypes.ROOTNODE: { RootNode iVisited = (RootNode) node; DynamicScope scope = iVisited.getScope(); // Serialization killed our dynamic scope. We can just create an empty one // since serialization cannot serialize an eval (which is the only thing // which is capable of having a non-empty dynamic scope). if (scope == null) { scope = new DynamicScope(iVisited.getStaticScope(), null); } // Each root node has a top-level scope that we need to push context.preRootNode(scope); // FIXME: Wire up BEGIN and END nodes try { return eval(context, iVisited.getBodyNode(), self); } finally { context.postRootNode(); } } case NodeTypes.SCLASSNODE: { SClassNode iVisited = (SClassNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass singletonClass; if (receiver.isNil()) { singletonClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { singletonClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure: can't extend object."); } singletonClass = receiver.getSingletonClass(); } if (context.getWrapper() != null) { singletonClass.extendObject(context.getWrapper()); singletonClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self); } case NodeTypes.SELFNODE: return self; case NodeTypes.SPLATNODE: { SplatNode iVisited = (SplatNode) node; return splatValue(evalInternal(context, iVisited.getValue(), self)); } //// case NodeTypes.STARNODE: //// EvaluateVisitor.starNodeVisitor.execute(this, node); //// break; case NodeTypes.STRNODE: { StrNode iVisited = (StrNode) node; return runtime.newString(iVisited.getValue()); } case NodeTypes.SUPERNODE: { SuperNode iVisited = (SuperNode) node; if (context.getFrameLastClass() == null) { throw runtime.newNameError("Superclass method '" + context.getFrameLastFunc() + "' disabled."); } context.beginCallArgs(); IRubyObject[] args = null; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return context.callSuper(args); } case NodeTypes.SVALUENODE: { SValueNode iVisited = (SValueNode) node; return aValueSplat(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.SYMBOLNODE: { SymbolNode iVisited = (SymbolNode) node; return runtime.newSymbol(iVisited.getName()); } case NodeTypes.TOARYNODE: { ToAryNode iVisited = (ToAryNode) node; return aryToAry(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.TRUENODE: { context.pollThreadEvents(); return runtime.getTrue(); } case NodeTypes.UNDEFNODE: { UndefNode iVisited = (UndefNode) node; if (context.getRubyClass() == null) { throw runtime .newTypeError("No class to undef method '" + iVisited.getName() + "'."); } context.getRubyClass().undef(iVisited.getName()); return runtime.getNil(); } case NodeTypes.UNTILNODE: { UntilNode iVisited = (UntilNode) node; IRubyObject result = runtime.getNil(); while (!(result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.VALIASNODE: { VAliasNode iVisited = (VAliasNode) node; runtime.getGlobalVariables().alias(iVisited.getNewName(), iVisited.getOldName()); return runtime.getNil(); } case NodeTypes.VCALLNODE: { VCallNode iVisited = (VCallNode) node; return self.callMethod(context, iVisited.getName(), IRubyObject.NULL_ARRAY, CallType.VARIABLE); } case NodeTypes.WHENNODE: assert false; return null; case NodeTypes.WHILENODE: { WhileNode iVisited = (WhileNode) node; IRubyObject result = runtime.getNil(); boolean firstTest = iVisited.evaluateAtStart(); while (!firstTest || (result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { firstTest = true; loop: while (true) { // Used for the 'redo' command try { evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return result; default: throw je; } } } } return result; } case NodeTypes.XSTRNODE: { XStrNode iVisited = (XStrNode) node; return self.callMethod(context, "`", runtime.newString(iVisited.getValue())); } case NodeTypes.YIELDNODE: { YieldNode iVisited = (YieldNode) node; IRubyObject result = evalInternal(context, iVisited.getArgsNode(), self); if (iVisited.getArgsNode() == null) { result = null; } return context.yieldCurrentBlock(result, null, null, iVisited.getCheckState()); } case NodeTypes.ZARRAYNODE: { return runtime.newArray(); } case NodeTypes.ZSUPERNODE: { if (context.getFrameLastClass() == null) { throw runtime.newNameError("superclass method '" + context.getFrameLastFunc() + "' disabled"); } return context.callSuper(context.getFrameArgs()); } } } while (true); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/1278c5bb3507a052d150d814f15453542ae41aed/EvaluationState.java/clean/src/org/jruby/evaluator/EvaluationState.java |
throw runtime.newNameError("superclass method '" + context.getFrameLastFunc() + "' disabled"); | String name = context.getFrameLastFunc(); throw runtime.newNameError("superclass method '" + name + "' disabled", name); | private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyObject self) { IRuby runtime = context.getRuntime(); bigloop: do { if (node == null) return runtime.getNil(); switch (node.nodeId) { case NodeTypes.ALIASNODE: { AliasNode iVisited = (AliasNode) node; if (context.getRubyClass() == null) { throw runtime.newTypeError("no class to make alias"); } context.getRubyClass().defineAlias(iVisited.getNewName(), iVisited.getOldName()); context.getRubyClass().callMethod(context, "method_added", runtime.newSymbol(iVisited.getNewName())); return runtime.getNil(); } case NodeTypes.ANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.ARGSCATNODE: { ArgsCatNode iVisited = (ArgsCatNode) node; IRubyObject args = evalInternal(context, iVisited.getFirstNode(), self); IRubyObject secondArgs = splatValue(evalInternal(context, iVisited.getSecondNode(), self)); RubyArray list = args instanceof RubyArray ? (RubyArray) args : runtime.newArray(args); return list.concat(secondArgs); } // case NodeTypes.ARGSNODE: // EvaluateVisitor.argsNodeVisitor.execute(this, node); // break; // case NodeTypes.ARGUMENTNODE: // EvaluateVisitor.argumentNodeVisitor.execute(this, node); // break; case NodeTypes.ARRAYNODE: { ArrayNode iVisited = (ArrayNode) node; IRubyObject[] array = new IRubyObject[iVisited.size()]; int i = 0; for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node next = (Node) iterator.next(); array[i++] = evalInternal(context, next, self); } return runtime.newArray(array); } // case NodeTypes.ASSIGNABLENODE: // EvaluateVisitor.assignableNodeVisitor.execute(this, node); // break; case NodeTypes.BACKREFNODE: { BackRefNode iVisited = (BackRefNode) node; IRubyObject backref = context.getBackref(); switch (iVisited.getType()) { case '~': return backref; case '&': return RubyRegexp.last_match(backref); case '`': return RubyRegexp.match_pre(backref); case '\'': return RubyRegexp.match_post(backref); case '+': return RubyRegexp.match_last(backref); } break; } case NodeTypes.BEGINNODE: { BeginNode iVisited = (BeginNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.BIGNUMNODE: { BignumNode iVisited = (BignumNode) node; return RubyBignum.newBignum(runtime, iVisited.getValue()); } // case NodeTypes.BINARYOPERATORNODE: // EvaluateVisitor.binaryOperatorNodeVisitor.execute(this, node); // break; // case NodeTypes.BLOCKARGNODE: // EvaluateVisitor.blockArgNodeVisitor.execute(this, node); // break; case NodeTypes.BLOCKNODE: { BlockNode iVisited = (BlockNode) node; IRubyObject result = runtime.getNil(); for (Iterator iter = iVisited.iterator(); iter.hasNext();) { result = evalInternal(context, (Node) iter.next(), self); } return result; } case NodeTypes.BLOCKPASSNODE: { BlockPassNode iVisited = (BlockPassNode) node; IRubyObject proc = evalInternal(context, iVisited.getBodyNode(), self); if (proc.isNil()) { context.setNoBlock(); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearNoBlock(); } } // If not already a proc then we should try and make it one. if (!(proc instanceof RubyProc)) { proc = proc.convertToType("Proc", "to_proc", false); if (!(proc instanceof RubyProc)) { throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)"); } } // TODO: Add safety check for taintedness Block block = (Block) context.getCurrentBlock(); if (block != null) { IRubyObject blockObject = block.getBlockObject(); // The current block is already associated with the proc. No need to create new // block for it. Just eval! if (blockObject != null && blockObject == proc) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearBlockAvailable(); } } } context.preBlockPassEval(((RubyProc) proc).getBlock()); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.postBlockPassEval(); } } case NodeTypes.BREAKNODE: { BreakNode iVisited = (BreakNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.BreakJump); je.setPrimaryData(result); je.setSecondaryData(node); throw je; } case NodeTypes.CALLNODE: { CallNode iVisited = (CallNode) node; context.beginCallArgs(); IRubyObject receiver = null; IRubyObject[] args = null; try { receiver = evalInternal(context, iVisited.getReceiverNode(), self); args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } assert receiver.getMetaClass() != null : receiver.getClass().getName(); // If reciever is self then we do the call the same way as vcall CallType callType = (receiver == self ? CallType.VARIABLE : CallType.NORMAL); return receiver.callMethod(context, iVisited.getName(), args, callType); } case NodeTypes.CASENODE: { CaseNode iVisited = (CaseNode) node; IRubyObject expression = null; if (iVisited.getCaseNode() != null) { expression = evalInternal(context, iVisited.getCaseNode(), self); } context.pollThreadEvents(); IRubyObject result = runtime.getNil(); Node firstWhenNode = iVisited.getFirstWhenNode(); while (firstWhenNode != null) { if (!(firstWhenNode instanceof WhenNode)) { node = firstWhenNode; continue bigloop; } WhenNode whenNode = (WhenNode) firstWhenNode; if (whenNode.getExpressionNodes() instanceof ArrayNode) { for (Iterator iter = ((ArrayNode) whenNode.getExpressionNodes()).iterator(); iter .hasNext();) { Node tag = (Node) iter.next(); context.setPosition(tag.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // Ruby grammar has nested whens in a case body because of // productions case_body and when_args. if (tag instanceof WhenNode) { RubyArray expressions = (RubyArray) evalInternal(context, ((WhenNode) tag) .getExpressionNodes(), self); for (int j = 0; j < expressions.getLength(); j++) { IRubyObject condition = expressions.entry(j); if ((expression != null && condition.callMethod(context, "===", expression) .isTrue()) || (expression == null && condition.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } continue; } result = evalInternal(context, tag, self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = whenNode.getBodyNode(); continue bigloop; } } } else { result = evalInternal(context, whenNode.getExpressionNodes(), self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } context.pollThreadEvents(); firstWhenNode = whenNode.getNextCase(); } return runtime.getNil(); } case NodeTypes.CLASSNODE: { ClassNode iVisited = (ClassNode) node; Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self); Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingClass = getEnclosingModule(context, classNameNode, self); RubyClass rubyClass = enclosingClass.defineOrGetClassUnder(name, superClass); if (context.getWrapper() != null) { rubyClass.extendObject(context.getWrapper()); rubyClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self); } case NodeTypes.CLASSVARASGNNODE: { ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__"); } rubyClass.setClassVar(iVisited.getName(), result); return result; } case NodeTypes.CLASSVARDECLNODE: { ClassVarDeclNode iVisited = (ClassVarDeclNode) node; // FIXME: shouldn't we use cref here? if (context.getRubyClass() == null) { throw runtime.newTypeError("no class/module to define class variable"); } IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); ((RubyModule) context.peekCRef().getValue()).setClassVar(iVisited.getName(), result); return runtime.getNil(); } case NodeTypes.CLASSVARNODE: { ClassVarNode iVisited = (ClassVarNode) node; RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule)rubyClass.getInstanceVariable("__attached__"); } return rubyClass.getClassVar(iVisited.getName()); } case NodeTypes.COLON2NODE: { Colon2Node iVisited = (Colon2Node) node; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { return runtime.getObject().getConstantFrom(iVisited.getName()); } else { IRubyObject result = evalInternal(context, iVisited.getLeftNode(), self); if (result instanceof RubyModule) { return ((RubyModule) result).getConstantFrom(iVisited.getName()); } else { return result.callMethod(context, iVisited.getName()); } } } case NodeTypes.COLON3NODE: { Colon3Node iVisited = (Colon3Node) node; return runtime.getObject().getConstantFrom(iVisited.getName()); } case NodeTypes.CONSTDECLNODE: { ConstDeclNode iVisited = (ConstDeclNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); IRubyObject module; if (iVisited.getPathNode() != null) { module = evalInternal(context, iVisited.getPathNode(), self); } else { // FIXME: why do we check RubyClass and then use CRef? if (context.getRubyClass() == null) { // TODO: wire into new exception handling mechanism throw runtime.newTypeError("no class/module to define constant"); } module = (RubyModule) context.peekCRef().getValue(); } // FIXME: shouldn't we use the result of this set in setResult? ((RubyModule) module).setConstant(iVisited.getName(), result); return result; } case NodeTypes.CONSTNODE: { ConstNode iVisited = (ConstNode) node; return context.getConstant(iVisited.getName()); } case NodeTypes.DASGNNODE: { DAsgnNode iVisited = (DAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("DSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.DEFINEDNODE: { DefinedNode iVisited = (DefinedNode) node; String definition = getDefinition(context, iVisited.getExpressionNode(), self); if (definition != null) { return runtime.newString(definition); } else { return runtime.getNil(); } } case NodeTypes.DEFNNODE: { DefnNode iVisited = (DefnNode) node; RubyModule containingClass = context.getRubyClass(); if (containingClass == null) { throw runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = context.getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod( name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass) containingClass).getAttachedObject().callMethod( context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod(context, "method_added", runtime.newSymbol(name)); } return runtime.getNil(); } case NodeTypes.DEFSNODE: { DefsNode iVisited = (DefsNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } if (!receiver.singletonMethodsAllowed()) { throw runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } RubyClass rubyClass = receiver.getSingletonClass(); if (runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); return runtime.getNil(); } case NodeTypes.DOTNODE: { DotNode iVisited = (DotNode) node; return RubyRange.newRange(runtime, evalInternal(context, iVisited.getBeginNode(), self), evalInternal(context, iVisited .getEndNode(), self), iVisited.isExclusive()); } case NodeTypes.DREGEXPNODE: { DRegexpNode iVisited = (DRegexpNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), lang); } case NodeTypes.DSTRNODE: { DStrNode iVisited = (DStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newString(sb.toString()); } case NodeTypes.DSYMBOLNODE: { DSymbolNode iVisited = (DSymbolNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.getNode().iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newSymbol(sb.toString()); } case NodeTypes.DVARNODE: { DVarNode iVisited = (DVarNode) node; // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; } case NodeTypes.DXSTRNODE: { DXStrNode iVisited = (DXStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return self.callMethod(context, "`", runtime.newString(sb.toString())); } case NodeTypes.ENSURENODE: { EnsureNode iVisited = (EnsureNode) node; // save entering the try if there's nothing to ensure if (iVisited.getEnsureNode() != null) { IRubyObject result = runtime.getNil(); try { result = evalInternal(context, iVisited.getBodyNode(), self); } finally { evalInternal(context, iVisited.getEnsureNode(), self); } return result; } node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.EVSTRNODE: { EvStrNode iVisited = (EvStrNode) node; node = iVisited.getBody(); continue bigloop; } case NodeTypes.FALSENODE: { context.pollThreadEvents(); return runtime.getFalse(); } case NodeTypes.FCALLNODE: { FCallNode iVisited = (FCallNode) node; context.beginCallArgs(); IRubyObject[] args; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return runtime.newFixnum(iVisited.getValue()); } case NodeTypes.FLIPNODE: { FlipNode iVisited = (FlipNode) node; IRubyObject result = runtime.getNil(); if (iVisited.isExclusive()) { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { result = evalInternal(context, iVisited.getBeginNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } else { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { if (evalInternal(context, iVisited.getBeginNode(), self).isTrue()) { context.getCurrentScope().setValue( iVisited.getIndex(), evalInternal(context, iVisited.getEndNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(), iVisited.getDepth()); return runtime.getTrue(); } else { return runtime.getFalse(); } } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } } case NodeTypes.FLOATNODE: { FloatNode iVisited = (FloatNode) node; return RubyFloat.newFloat(runtime, iVisited.getValue()); } case NodeTypes.FORNODE: { ForNode iVisited = (ForNode) node; // For nodes do not have to create an addition scope so we just pass null context.preForLoopEval(Block.createBlock(iVisited.getVarNode(), null, iVisited.getCallable(), self)); try { while (true) { try { ISourcePosition position = context.getPosition(); context.beginCallArgs(); IRubyObject recv = null; try { recv = evalInternal(context, iVisited.getIterNode(), self); } finally { context.setPosition(position); context.endCallArgs(); } return recv.callMethod(context, "each", IRubyObject.NULL_ARRAY, CallType.NORMAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // do nothing, allow loop to retry break; default: throw je; } } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postForLoopEval(); } } case NodeTypes.GLOBALASGNNODE: { GlobalAsgnNode iVisited = (GlobalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); runtime.getGlobalVariables().set(iVisited.getName(), result); return result; } case NodeTypes.GLOBALVARNODE: { GlobalVarNode iVisited = (GlobalVarNode) node; return runtime.getGlobalVariables().get(iVisited.getName()); } case NodeTypes.HASHNODE: { HashNode iVisited = (HashNode) node; Map hash = null; if (iVisited.getListNode() != null) { hash = new HashMap(iVisited.getListNode().size() / 2); for (Iterator iterator = iVisited.getListNode().iterator(); iterator.hasNext();) { // insert all nodes in sequence, hash them in the final instruction // KEY IRubyObject key = evalInternal(context, (Node) iterator.next(), self); IRubyObject value = evalInternal(context, (Node) iterator.next(), self); hash.put(key, value); } } if (hash == null) { return RubyHash.newHash(runtime); } return RubyHash.newHash(runtime, hash, runtime.getNil()); } case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; IRubyObject result = evalInternal(context, iVisited.getCondition(), self); if (result.isTrue()) { node = iVisited.getThenBody(); continue bigloop; } else { node = iVisited.getElseBody(); continue bigloop; } } case NodeTypes.INSTASGNNODE: { InstAsgnNode iVisited = (InstAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); self.setInstanceVariable(iVisited.getName(), result); return result; } case NodeTypes.INSTVARNODE: { InstVarNode iVisited = (InstVarNode) node; IRubyObject variable = self.getInstanceVariable(iVisited.getName()); return variable == null ? runtime.getNil() : variable; } // case NodeTypes.ISCOPINGNODE: // EvaluateVisitor.iScopingNodeVisitor.execute(this, node); // break; case NodeTypes.ITERNODE: { IterNode iVisited = (IterNode) node; context.preIterEval(Block.createBlock(iVisited.getVarNode(), new DynamicScope(iVisited.getScope(), context.getCurrentScope()), iVisited.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.LOCALASGNNODE: { LocalAsgnNode iVisited = (LocalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("LSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.LOCALVARNODE: { LocalVarNode iVisited = (LocalVarNode) node; //System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); return result == null ? runtime.getNil() : result; } case NodeTypes.MATCH2NODE: { Match2Node iVisited = (Match2Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); return ((RubyRegexp) recv).match(value); } case NodeTypes.MATCH3NODE: { Match3Node iVisited = (Match3Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); if (value instanceof RubyString) { return ((RubyRegexp) recv).match(value); } else { return value.callMethod(context, "=~", recv); } } case NodeTypes.MATCHNODE: { MatchNode iVisited = (MatchNode) node; return ((RubyRegexp) evalInternal(context, iVisited.getRegexpNode(), self)).match2(); } case NodeTypes.MODULENODE: { ModuleNode iVisited = (ModuleNode) node; Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingModule = getEnclosingModule(context, classNameNode, self); if (enclosingModule == null) { throw runtime.newTypeError("no outer class/module"); } RubyModule module; if (enclosingModule == runtime.getObject()) { module = runtime.getOrCreateModule(name); } else { module = enclosingModule.defineModuleUnder(name); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self); } case NodeTypes.MULTIPLEASGNNODE: { MultipleAsgnNode iVisited = (MultipleAsgnNode) node; return AssignmentVisitor.assign(context, self, iVisited, evalInternal(context, iVisited.getValueNode(), self), false); } case NodeTypes.NEWLINENODE: { NewlineNode iVisited = (NewlineNode) node; // something in here is used to build up ruby stack trace... context.setPosition(iVisited.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // TODO: do above but not below for additional newline nodes node = iVisited.getNextNode(); continue bigloop; } case NodeTypes.NEXTNODE: { NextNode iVisited = (NextNode) node; context.pollThreadEvents(); IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.NextJump); je.setPrimaryData(result); je.setSecondaryData(iVisited); //state.setCurrentException(je); throw je; } case NodeTypes.NILNODE: return runtime.getNil(); case NodeTypes.NOTNODE: { NotNode iVisited = (NotNode) node; IRubyObject result = evalInternal(context, iVisited.getConditionNode(), self); return result.isTrue() ? runtime.getFalse() : runtime.getTrue(); } case NodeTypes.NTHREFNODE: { NthRefNode iVisited = (NthRefNode) node; return RubyRegexp.nth_match(iVisited.getMatchNumber(), context.getBackref()); } case NodeTypes.OPASGNANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; // add in reverse order IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.OPASGNNODE: { OpAsgnNode iVisited = (OpAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = receiver.callMethod(context, iVisited.getVariableName()); if (iVisited.getOperatorName().equals("||")) { if (value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else { value = value.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited.getValueNode(), self)); } receiver.callMethod(context, iVisited.getVariableName() + "=", value); context.pollThreadEvents(); return value; } case NodeTypes.OPASGNORNODE: { OpAsgnOrNode iVisited = (OpAsgnOrNode) node; String def = getDefinition(context, iVisited.getFirstNode(), self); IRubyObject result = runtime.getNil(); if (def != null) { result = evalInternal(context, iVisited.getFirstNode(), self); } if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } case NodeTypes.OPELEMENTASGNNODE: { OpElementAsgnNode iVisited = (OpElementAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); IRubyObject firstValue = receiver.callMethod(context, "[]", args); if (iVisited.getOperatorName().equals("||")) { if (firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else { firstValue = firstValue.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited .getValueNode(), self)); } IRubyObject[] expandedArgs = new IRubyObject[args.length + 1]; System.arraycopy(args, 0, expandedArgs, 0, args.length); expandedArgs[expandedArgs.length - 1] = firstValue; return receiver.callMethod(context, "[]=", expandedArgs); } case NodeTypes.OPTNNODE: { OptNNode iVisited = (OptNNode) node; IRubyObject result = runtime.getNil(); while (RubyKernel.gets(runtime.getTopSelf(), IRubyObject.NULL_ARRAY).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: // do nothing, this iteration restarts break; case JumpType.NEXT: // recheck condition break loop; case JumpType.BREAK: // end loop return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.ORNODE: { OrNode iVisited = (OrNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } // case NodeTypes.POSTEXENODE: // EvaluateVisitor.postExeNodeVisitor.execute(this, node); // break; case NodeTypes.REDONODE: { context.pollThreadEvents(); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.RedoJump); je.setSecondaryData(node); throw je; } case NodeTypes.REGEXPNODE: { RegexpNode iVisited = (RegexpNode) node; String lang = null; int opts = iVisited.getOptions(); if((opts & 16) != 0) { // param n lang = "n"; } else if((opts & 48) != 0) { // param s lang = "s"; } else if((opts & 64) != 0) { // param s lang = "u"; } return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), lang); } case NodeTypes.RESCUEBODYNODE: { RescueBodyNode iVisited = (RescueBodyNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.RESCUENODE: { RescueNode iVisited = (RescueNode)node; RescuedBlock : while (true) { try { // Execute rescue block IRubyObject result = evalInternal(context, iVisited.getBodyNode(), self); // If no exception is thrown execute else block if (iVisited.getElseNode() != null) { if (iVisited.getRescueNode() == null) { runtime.getWarnings().warn(iVisited.getElseNode().getPosition(), "else without rescue is useless"); } result = evalInternal(context, iVisited.getElseNode(), self); } return result; } catch (RaiseException raiseJump) { RubyException raisedException = raiseJump.getException(); // TODO: Rubicon TestKernel dies without this line. A cursory glance implies we // falsely set $! to nil and this sets it back to something valid. This should // get fixed at the same time we address bug #1296484. runtime.getGlobalVariables().set("$!", raisedException); RescueBodyNode rescueNode = iVisited.getRescueNode(); while (rescueNode != null) { Node exceptionNodes = rescueNode.getExceptionNodes(); ListNode exceptionNodesList; if (exceptionNodes instanceof SplatNode) { exceptionNodesList = (ListNode) evalInternal(context, exceptionNodes, self); } else { exceptionNodesList = (ListNode) exceptionNodes; } if (isRescueHandled(context, raisedException, exceptionNodesList, self)) { try { return evalInternal(context, rescueNode, self); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.RetryJump) { // should be handled in the finally block below //state.runtime.getGlobalVariables().set("$!", state.runtime.getNil()); //state.threadContext.setRaisedException(null); continue RescuedBlock; } else { throw je; } } } rescueNode = rescueNode.getOptRescueNode(); } // no takers; bubble up throw raiseJump; } finally { // clear exception when handled or retried runtime.getGlobalVariables().set("$!", runtime.getNil()); } } } case NodeTypes.RETRYNODE: { context.pollThreadEvents(); JumpException je = new JumpException(JumpException.JumpType.RetryJump); throw je; } case NodeTypes.RETURNNODE: { ReturnNode iVisited = (ReturnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.ReturnJump); je.setPrimaryData(iVisited.getTarget()); je.setSecondaryData(result); je.setTertiaryData(iVisited); throw je; } case NodeTypes.ROOTNODE: { RootNode iVisited = (RootNode) node; DynamicScope scope = iVisited.getScope(); // Serialization killed our dynamic scope. We can just create an empty one // since serialization cannot serialize an eval (which is the only thing // which is capable of having a non-empty dynamic scope). if (scope == null) { scope = new DynamicScope(iVisited.getStaticScope(), null); } // Each root node has a top-level scope that we need to push context.preRootNode(scope); // FIXME: Wire up BEGIN and END nodes try { return eval(context, iVisited.getBodyNode(), self); } finally { context.postRootNode(); } } case NodeTypes.SCLASSNODE: { SClassNode iVisited = (SClassNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass singletonClass; if (receiver.isNil()) { singletonClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { singletonClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure: can't extend object."); } singletonClass = receiver.getSingletonClass(); } if (context.getWrapper() != null) { singletonClass.extendObject(context.getWrapper()); singletonClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self); } case NodeTypes.SELFNODE: return self; case NodeTypes.SPLATNODE: { SplatNode iVisited = (SplatNode) node; return splatValue(evalInternal(context, iVisited.getValue(), self)); } //// case NodeTypes.STARNODE: //// EvaluateVisitor.starNodeVisitor.execute(this, node); //// break; case NodeTypes.STRNODE: { StrNode iVisited = (StrNode) node; return runtime.newString(iVisited.getValue()); } case NodeTypes.SUPERNODE: { SuperNode iVisited = (SuperNode) node; if (context.getFrameLastClass() == null) { throw runtime.newNameError("Superclass method '" + context.getFrameLastFunc() + "' disabled."); } context.beginCallArgs(); IRubyObject[] args = null; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return context.callSuper(args); } case NodeTypes.SVALUENODE: { SValueNode iVisited = (SValueNode) node; return aValueSplat(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.SYMBOLNODE: { SymbolNode iVisited = (SymbolNode) node; return runtime.newSymbol(iVisited.getName()); } case NodeTypes.TOARYNODE: { ToAryNode iVisited = (ToAryNode) node; return aryToAry(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.TRUENODE: { context.pollThreadEvents(); return runtime.getTrue(); } case NodeTypes.UNDEFNODE: { UndefNode iVisited = (UndefNode) node; if (context.getRubyClass() == null) { throw runtime .newTypeError("No class to undef method '" + iVisited.getName() + "'."); } context.getRubyClass().undef(iVisited.getName()); return runtime.getNil(); } case NodeTypes.UNTILNODE: { UntilNode iVisited = (UntilNode) node; IRubyObject result = runtime.getNil(); while (!(result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.VALIASNODE: { VAliasNode iVisited = (VAliasNode) node; runtime.getGlobalVariables().alias(iVisited.getNewName(), iVisited.getOldName()); return runtime.getNil(); } case NodeTypes.VCALLNODE: { VCallNode iVisited = (VCallNode) node; return self.callMethod(context, iVisited.getName(), IRubyObject.NULL_ARRAY, CallType.VARIABLE); } case NodeTypes.WHENNODE: assert false; return null; case NodeTypes.WHILENODE: { WhileNode iVisited = (WhileNode) node; IRubyObject result = runtime.getNil(); boolean firstTest = iVisited.evaluateAtStart(); while (!firstTest || (result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { firstTest = true; loop: while (true) { // Used for the 'redo' command try { evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return result; default: throw je; } } } } return result; } case NodeTypes.XSTRNODE: { XStrNode iVisited = (XStrNode) node; return self.callMethod(context, "`", runtime.newString(iVisited.getValue())); } case NodeTypes.YIELDNODE: { YieldNode iVisited = (YieldNode) node; IRubyObject result = evalInternal(context, iVisited.getArgsNode(), self); if (iVisited.getArgsNode() == null) { result = null; } return context.yieldCurrentBlock(result, null, null, iVisited.getCheckState()); } case NodeTypes.ZARRAYNODE: { return runtime.newArray(); } case NodeTypes.ZSUPERNODE: { if (context.getFrameLastClass() == null) { throw runtime.newNameError("superclass method '" + context.getFrameLastFunc() + "' disabled"); } return context.callSuper(context.getFrameArgs()); } } } while (true); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/1278c5bb3507a052d150d814f15453542ae41aed/EvaluationState.java/clean/src/org/jruby/evaluator/EvaluationState.java |
ImageNode n = (ImageNode) pce.getNewValue(); ClassifyCmd cmd = new ClassifyCmd( (ImageData) n.getHierarchyObject(), Classifier.DECLASSIFICATION_MODE, view, model.getUserDetails().getId(), model.getRootID(), model.getRootLevel()); cmd.execute(); | ImageDisplay n = (ImageDisplay) pce.getNewValue(); model.getClipBoard().setSelectedPane(ClipBoard.CLASSIFICATION_PANE, n); model.getBrowser().setSelectedDisplay(n); | public void propertyChange(PropertyChangeEvent pce) { String propName = pce.getPropertyName(); if (Browser.POPUP_POINT_PROPERTY.equals(propName)) { Browser browser = model.getBrowser(); ImageDisplay d = browser.getLastSelectedDisplay(); Point p = browser.getPopupPoint(); if (d != null && p != null) view.showPopup(d, p); } else if (Browser.THUMB_SELECTED_PROPERTY.equals(propName)) { ImageNode d = (ImageNode) pce.getNewValue(); if (d != null) ThumbWinManager.display(d, model); } else if (Browser.SELECTED_DISPLAY_PROPERTY.equals(propName)) { TreeView treeView = model.getTreeView(); if (treeView == null) return; ImageDisplay d = model.getBrowser().getLastSelectedDisplay(); treeView.accept(new SelectedNodeVisitor(treeView, d)); } else if (TreeView.TREE_POPUP_POINT_PROPERTY.equals(propName)) { TreeView treeView = model.getTreeView(); if (treeView == null) return; //tree shouldn't be null Point p = treeView.getPopupPoint(); if (p != null) view.showPopup(((JComponent) pce.getNewValue()), p); } else if (TreeView.CLOSE_PROPERTY.equals(propName)) { model.showTreeView(false); } else if (TreeView.TREE_SELECTED_DISPLAY_PROPERTY.equals(propName)) { TreeView treeView = model.getTreeView(); if (treeView == null) return; //tree shouldn't be null Browser browser = model.getBrowser(); ImageDisplay img = (ImageDisplay) pce.getNewValue(); if (img != null) { if (!(img.equals(browser.getLastSelectedDisplay()))) browser.setSelectedDisplay(img); } else browser.setSelectedDisplay(img); } else if (HiViewer.SCROLL_TO_NODE_PROPERTY.equals(propName)) { scrollToNode((ImageDisplay) pce.getNewValue()); } else if (Browser.ANNOTATED_NODE_PROPERTY.equals(propName)) { ImageDisplay n = (ImageDisplay) pce.getNewValue(); model.getClipBoard().setSelectedPane(ClipBoard.ANNOTATION_PANE, n); model.getBrowser().setSelectedDisplay(n); } else if (Browser.CLASSIFIED_NODE_PROPERTY.equals(propName)) { ImageNode n = (ImageNode) pce.getNewValue(); ClassifyCmd cmd = new ClassifyCmd( (ImageData) n.getHierarchyObject(), Classifier.DECLASSIFICATION_MODE, view, model.getUserDetails().getId(), model.getRootID(), model.getRootLevel()); cmd.execute(); } else if (Browser.ROLL_OVER_PROPERTY.equals(propName)) { if (model.isRollOver()) { ImageDisplay n = (ImageDisplay) pce.getNewValue(); if (n instanceof ImageNode) ThumbWinManager.rollOverDisplay((ImageNode) n, model.getBrowser()); else ThumbWinManager.rollOverDisplay(null, model.getBrowser()); } } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/fd92d515888f8a291e88662ff409e72ea5f96f1b/HiViewerControl.java/buggy/SRC/org/openmicroscopy/shoola/agents/hiviewer/view/HiViewerControl.java |
static void display(ImageNode node) | static void display(ImageNode node, HiViewer model) | static void display(ImageNode node) { if (node == null) throw new IllegalArgumentException("No node."); TinyDialog w = getWindowFor(node); if (w != null) { //Could be null, see notes in getWindowFor(). w.pack(); //Now we have the right width and height. Point p = getWindowLocation(node, w.getWidth(), w.getHeight()); w.setCollapsed(false); w.moveToFront(p); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/b4992016524102ee0a5c7465d4cc7a94e9ffce2d/ThumbWinManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/hiviewer/view/ThumbWinManager.java |
TinyDialog w = getWindowFor(node); | if (model == null) throw new IllegalArgumentException("No model."); TinyDialog w = getWindowFor(node, model); | static void display(ImageNode node) { if (node == null) throw new IllegalArgumentException("No node."); TinyDialog w = getWindowFor(node); if (w != null) { //Could be null, see notes in getWindowFor(). w.pack(); //Now we have the right width and height. Point p = getWindowLocation(node, w.getWidth(), w.getHeight()); w.setCollapsed(false); w.moveToFront(p); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/b4992016524102ee0a5c7465d4cc7a94e9ffce2d/ThumbWinManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/hiviewer/view/ThumbWinManager.java |
return (RenderingEngine) this.ctx.getBean("renderingService"); | return (RenderingEngine) this.ctx.getBean("renderService"); | public RenderingEngine getRenderingService(){ return (RenderingEngine) this.ctx.getBean("renderingService"); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/92c787632618062d83f0fc8bcbfa71d70e18c6aa/ServiceFactory.java/buggy/components/common/src/ome/system/ServiceFactory.java |
if (running) { | if (!running) { | public Object invoke(ObjectName objectName, String methodName) throws org.apache.geronimo.kernel.GBeanNotFoundException, org.apache.geronimo.kernel.NoSuchOperationException, Exception { boolean running = isRunning(objectName); if (running) { throw new IllegalStateException("Service is not running: name=" + objectName); } ServiceInvoker serviceInvoker = getServiceInvoker(objectName); try { Object value = serviceInvoker.invoke(methodName, NO_ARGS, NO_TYPES); return value; } catch (NoSuchOperationException e) { throw new org.apache.geronimo.kernel.NoSuchOperationException(e); } } | 52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/4e058fb9713f5562d177ef9ad0111005cd8cf4b9/KernelBridge.java/buggy/kernel/src/java/org/gbean/geronimo/KernelBridge.java |
public Node newArgs(Object f, Node o, RubyId r) { return null; | public Node newArgs(Integer count, Node optNode, RubyId rest) { return new ArgsNode(optNode, rest != null ? rest.intValue() : 0, count != null ? count.intValue() : 0); | public Node newArgs(Object f, Node o, RubyId r) { // +++ // return new ArgsNode(o, r, f); // --- return null; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9a05f18f2b6207bf93455d756436fe8f0002b542/NodeFactory.java/buggy/org/jruby/nodes/NodeFactory.java |
if (!Character.isWhitespace(s.charAt(i))) return s.substring(0, i); | if (!Character.isWhitespace(s.charAt(i))) return s.substring(0, i+1); | public static String rtrim(String s) { if (s == null) return null; for (int i = s.length() - 1; i > -1; i--) { if (!Character.isWhitespace(s.charAt(i))) return s.substring(0, i); } // if all WS return empty string return ""; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/daf1b0f29c35e449ab29a2e11dcac001acbdf634/TextTool.java/buggy/webmacro/src/org/webmacro/servlet/TextTool.java |
public static Criteria buildCategoryGroupCriteria(int groupID) | public static Criteria buildCategoryGroupCriteria(int groupID, int userID) | public static Criteria buildCategoryGroupCriteria(int groupID) { Criteria c = new Criteria(); c.addWantedField("Name"); c.addWantedField("Description"); c.addWantedField("CategoryList"); c.addWantedField("module_execution"); c.addWantedField("CategoryList", "Name"); c.addWantedField("CategoryList", "ClassificationList"); c.addWantedField("CategoryList.ClassificationList", "Valid"); c.addWantedField("CategoryList.ClassificationList", "image"); c.addWantedField("CategoryList", "module_execution"); c.addWantedField("CategoryList.module_execution", "experimenter"); c.addWantedField("CategoryList.ClassificationList", "module_execution"); c.addWantedField("CategoryList.ClassificationList.module_execution", "experimenter"); //Specify which fields we want for the owner. //group mex c.addWantedField("module_execution", "experimenter"); if (groupID != -1) c.addFilter("id", new Integer(groupID)); return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/CategoryMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/CategoryMapper.java |
c.addWantedField("module_execution"); | public static Criteria buildCategoryGroupCriteria(int groupID) { Criteria c = new Criteria(); c.addWantedField("Name"); c.addWantedField("Description"); c.addWantedField("CategoryList"); c.addWantedField("module_execution"); c.addWantedField("CategoryList", "Name"); c.addWantedField("CategoryList", "ClassificationList"); c.addWantedField("CategoryList.ClassificationList", "Valid"); c.addWantedField("CategoryList.ClassificationList", "image"); c.addWantedField("CategoryList", "module_execution"); c.addWantedField("CategoryList.module_execution", "experimenter"); c.addWantedField("CategoryList.ClassificationList", "module_execution"); c.addWantedField("CategoryList.ClassificationList.module_execution", "experimenter"); //Specify which fields we want for the owner. //group mex c.addWantedField("module_execution", "experimenter"); if (groupID != -1) c.addFilter("id", new Integer(groupID)); return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/CategoryMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/CategoryMapper.java |
|
c.addWantedField("module_execution", "experimenter"); | public static Criteria buildCategoryGroupCriteria(int groupID) { Criteria c = new Criteria(); c.addWantedField("Name"); c.addWantedField("Description"); c.addWantedField("CategoryList"); c.addWantedField("module_execution"); c.addWantedField("CategoryList", "Name"); c.addWantedField("CategoryList", "ClassificationList"); c.addWantedField("CategoryList.ClassificationList", "Valid"); c.addWantedField("CategoryList.ClassificationList", "image"); c.addWantedField("CategoryList", "module_execution"); c.addWantedField("CategoryList.module_execution", "experimenter"); c.addWantedField("CategoryList.ClassificationList", "module_execution"); c.addWantedField("CategoryList.ClassificationList.module_execution", "experimenter"); //Specify which fields we want for the owner. //group mex c.addWantedField("module_execution", "experimenter"); if (groupID != -1) c.addFilter("id", new Integer(groupID)); return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/CategoryMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/CategoryMapper.java |
|
if (userID != -1) c.addFilter("module_execution.experimenter_id", new Integer(userID)); | public static Criteria buildCategoryGroupCriteria(int groupID) { Criteria c = new Criteria(); c.addWantedField("Name"); c.addWantedField("Description"); c.addWantedField("CategoryList"); c.addWantedField("module_execution"); c.addWantedField("CategoryList", "Name"); c.addWantedField("CategoryList", "ClassificationList"); c.addWantedField("CategoryList.ClassificationList", "Valid"); c.addWantedField("CategoryList.ClassificationList", "image"); c.addWantedField("CategoryList", "module_execution"); c.addWantedField("CategoryList.module_execution", "experimenter"); c.addWantedField("CategoryList.ClassificationList", "module_execution"); c.addWantedField("CategoryList.ClassificationList.module_execution", "experimenter"); //Specify which fields we want for the owner. //group mex c.addWantedField("module_execution", "experimenter"); if (groupID != -1) c.addFilter("id", new Integer(groupID)); return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/CategoryMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/CategoryMapper.java |
|
public static Criteria buildDatasetAnnotationCriteria(int datasetID) | public static Criteria buildDatasetAnnotationCriteria(List datasetIDs, int userID) | public static Criteria buildDatasetAnnotationCriteria(int datasetID) { Criteria c = new Criteria(); fillAnnotationCriteria(c); c.addWantedField("dataset"); c.addFilter("dataset_id", new Integer(datasetID)); return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/AnnotationMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/AnnotationMapper.java |
c.addFilter("dataset_id", new Integer(datasetID)); | c.addFilter("dataset_id", "IN", datasetIDs); if (userID != -1) c.addFilter("module_execution.experimenter_id", new Integer(userID)); | public static Criteria buildDatasetAnnotationCriteria(int datasetID) { Criteria c = new Criteria(); fillAnnotationCriteria(c); c.addWantedField("dataset"); c.addFilter("dataset_id", new Integer(datasetID)); return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/AnnotationMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/AnnotationMapper.java |
public static Criteria buildICGHierarchyCriteria(List imageIDs) | public static Criteria buildICGHierarchyCriteria(List imageIDs, int userID) | public static Criteria buildICGHierarchyCriteria(List imageIDs) { Criteria c = new Criteria(); c.addWantedField("Confidence"); c.addWantedField("Category"); c.addWantedField("module_execution"); c.addWantedField("module_execution", "experimenter"); //Specify which fields we want for the owner. c.addWantedField("module_execution.experimenter", "id"); //Fields for the category c.addWantedField("Category", "Name"); c.addWantedField("Category", "Description"); c.addWantedField("Category", "CategoryGroup"); c.addWantedField("Category.CategoryGroup", "Name"); c.addWantedField("Category.CategoryGroup", "Description"); //Fields we want for the images. c.addWantedField("image"); c.addWantedField("image", "id"); c.addFilter("image_id", "IN", imageIDs); //In this case, the filter should work ;-) return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/HierarchyMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/HierarchyMapper.java |
c.addWantedField("module_execution"); c.addWantedField("module_execution", "experimenter"); | public static Criteria buildICGHierarchyCriteria(List imageIDs) { Criteria c = new Criteria(); c.addWantedField("Confidence"); c.addWantedField("Category"); c.addWantedField("module_execution"); c.addWantedField("module_execution", "experimenter"); //Specify which fields we want for the owner. c.addWantedField("module_execution.experimenter", "id"); //Fields for the category c.addWantedField("Category", "Name"); c.addWantedField("Category", "Description"); c.addWantedField("Category", "CategoryGroup"); c.addWantedField("Category.CategoryGroup", "Name"); c.addWantedField("Category.CategoryGroup", "Description"); //Fields we want for the images. c.addWantedField("image"); c.addWantedField("image", "id"); c.addFilter("image_id", "IN", imageIDs); //In this case, the filter should work ;-) return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/HierarchyMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/HierarchyMapper.java |
|
c.addWantedField("module_execution.experimenter", "id"); | public static Criteria buildICGHierarchyCriteria(List imageIDs) { Criteria c = new Criteria(); c.addWantedField("Confidence"); c.addWantedField("Category"); c.addWantedField("module_execution"); c.addWantedField("module_execution", "experimenter"); //Specify which fields we want for the owner. c.addWantedField("module_execution.experimenter", "id"); //Fields for the category c.addWantedField("Category", "Name"); c.addWantedField("Category", "Description"); c.addWantedField("Category", "CategoryGroup"); c.addWantedField("Category.CategoryGroup", "Name"); c.addWantedField("Category.CategoryGroup", "Description"); //Fields we want for the images. c.addWantedField("image"); c.addWantedField("image", "id"); c.addFilter("image_id", "IN", imageIDs); //In this case, the filter should work ;-) return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/HierarchyMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/HierarchyMapper.java |
|
if (userID != -1) c.addFilter("module_execution.experimenter_id", new Integer(userID)); | public static Criteria buildICGHierarchyCriteria(List imageIDs) { Criteria c = new Criteria(); c.addWantedField("Confidence"); c.addWantedField("Category"); c.addWantedField("module_execution"); c.addWantedField("module_execution", "experimenter"); //Specify which fields we want for the owner. c.addWantedField("module_execution.experimenter", "id"); //Fields for the category c.addWantedField("Category", "Name"); c.addWantedField("Category", "Description"); c.addWantedField("Category", "CategoryGroup"); c.addWantedField("Category.CategoryGroup", "Name"); c.addWantedField("Category.CategoryGroup", "Description"); //Fields we want for the images. c.addWantedField("image"); c.addWantedField("image", "id"); c.addFilter("image_id", "IN", imageIDs); //In this case, the filter should work ;-) return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/HierarchyMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/HierarchyMapper.java |
|
public static Criteria buildBasicCriteria(int id) | public static Criteria buildBasicCriteria(int id, int userID) | public static Criteria buildBasicCriteria(int id) { Criteria c = new Criteria(); c.addWantedField("Name"); c.addWantedField("Description"); c.addWantedField("module_execution"); c.addWantedField("module_execution", "experimenter"); //Specify which fields we want for the owner. c.addWantedField("module_execution.experimenter", "id"); if (id != -1) c.addFilter("id", new Integer(id)); return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/CategoryMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/CategoryMapper.java |
if (userID != -1) c.addFilter("module_execution.experimenter_id", new Integer(userID)); | public static Criteria buildBasicCriteria(int id) { Criteria c = new Criteria(); c.addWantedField("Name"); c.addWantedField("Description"); c.addWantedField("module_execution"); c.addWantedField("module_execution", "experimenter"); //Specify which fields we want for the owner. c.addWantedField("module_execution.experimenter", "id"); if (id != -1) c.addFilter("id", new Integer(id)); return c; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/01a27ecff15f0a14ff349eccd47a12de073ae838/CategoryMapper.java/buggy/SRC/org/openmicroscopy/shoola/env/data/map/CategoryMapper.java |
|
public WeakReferenceListNode(Object ref, ReferenceQueue queue, WeakReferenceListNode prev) { | public WeakReferenceListNode(Object ref, ReferenceQueue queue, WeakReferenceListNode next) { | public WeakReferenceListNode(Object ref, ReferenceQueue queue, WeakReferenceListNode prev) { super(ref, queue); this.prev = prev; if (prev != null) { prev.next = this; } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b174080e1ae646a0fc8e25372ec51dc664d92f79/ObjectSpace.java/buggy/src/org/jruby/runtime/ObjectSpace.java |
this.prev = prev; if (prev != null) { prev.next = this; | this.next = next; if (next != null) { next.prev = this; | public WeakReferenceListNode(Object ref, ReferenceQueue queue, WeakReferenceListNode prev) { super(ref, queue); this.prev = prev; if (prev != null) { prev.next = this; } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b174080e1ae646a0fc8e25372ec51dc664d92f79/ObjectSpace.java/buggy/src/org/jruby/runtime/ObjectSpace.java |
if (prev != null) { prev.next = next; } if (next != null) { next.prev = prev; } | synchronized (ObjectSpace.this) { if (prev != null) { prev.next = next; } if (next != null) { next.prev = prev; } } | public void remove() { if (prev != null) { prev.next = next; } if (next != null) { next.prev = prev; } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b174080e1ae646a0fc8e25372ec51dc664d92f79/ObjectSpace.java/buggy/src/org/jruby/runtime/ObjectSpace.java |
private void cleanup() { | private synchronized void cleanup() { | private void cleanup() { WeakReferenceListNode reference; while ((reference = (WeakReferenceListNode)deadReferences.poll()) != null) { reference.remove(); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b174080e1ae646a0fc8e25372ec51dc664d92f79/ObjectSpace.java/buggy/src/org/jruby/runtime/ObjectSpace.java |
public Iterator iterator(RubyModule rubyClass) { return new ObjectSpaceIterator(rubyClass); | public synchronized Iterator iterator(RubyModule rubyClass) { final List objList = new ArrayList(); WeakReferenceListNode current = top; while (current != null) { IRubyObject obj = (IRubyObject)current.get(); if (obj != null && obj.isKindOf(rubyClass)) { objList.add(current); } current = current.next; } return new Iterator() { private Iterator iter = objList.iterator(); public boolean hasNext() { return iter.hasNext(); } public Object next() { return ((WeakReferenceListNode)iter.next()).get(); } public void remove() { throw new UnsupportedOperationException(); } }; | public Iterator iterator(RubyModule rubyClass) { return new ObjectSpaceIterator(rubyClass); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b174080e1ae646a0fc8e25372ec51dc664d92f79/ObjectSpace.java/buggy/src/org/jruby/runtime/ObjectSpace.java |
MessengerDialog d = new MessengerDialog(SHARED_FRAME, DEFAULT_COMMENT_TITLE, "", e); | if (title == null || title.length() == 0) title = DEFAULT_ERROR_TITLE; MessengerDialog d = new MessengerDialog(SHARED_FRAME, title, "", e); | private void showErrorDialog(String title, String summary, String detail) { Exception e; if (detail == null) e = new Exception(summary); else e = new Exception(detail); MessengerDialog d = new MessengerDialog(SHARED_FRAME, DEFAULT_COMMENT_TITLE, "", e); d.addPropertyChangeListener(manager); d.setModal(true); UIUtilities.centerAndShow(d); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/5aacd98a1cfb2219e218c87eed17b5a0f0e9738a/UserNotifierImpl.java/clean/SRC/org/openmicroscopy/shoola/env/ui/UserNotifierImpl.java |
private IRubyObject yieldUnder(RubyModule under) { return under.executeUnder(new Callback() { public IRubyObject execute(IRubyObject self, IRubyObject[] args) { ThreadContext context = getRuntime().getCurrentContext(); Block block = (Block) context.getBlockStack().peek(); Visibility savedVisibility = block.getVisibility(); block.setVisibility(Visibility.PUBLIC); try { IRubyObject valueInYield = args[0]; IRubyObject selfInYield = args[0]; return context.yield(valueInYield, selfInYield, context.getRubyClass(), false, false); } catch (BreakJump e) { IRubyObject breakValue = e.getBreakValue(); return breakValue == null ? getRuntime().getNil() : breakValue; } finally { block.setVisibility(savedVisibility); } } public Arity getArity() { return Arity.optional(); } }, new IRubyObject[] { this }); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/50d6342dd5da06c42d25bc955addce6aaa0e6b97/RubyObject.java/clean/src/org/jruby/RubyObject.java |
||
public IRubyObject execute(IRubyObject self, IRubyObject[] args) { ThreadContext context = getRuntime().getCurrentContext(); Block block = (Block) context.getBlockStack().peek(); Visibility savedVisibility = block.getVisibility(); block.setVisibility(Visibility.PUBLIC); try { IRubyObject valueInYield = args[0]; IRubyObject selfInYield = args[0]; return context.yield(valueInYield, selfInYield, context.getRubyClass(), false, false); } catch (BreakJump e) { IRubyObject breakValue = e.getBreakValue(); return breakValue == null ? getRuntime().getNil() : breakValue; } finally { block.setVisibility(savedVisibility); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/50d6342dd5da06c42d25bc955addce6aaa0e6b97/RubyObject.java/clean/src/org/jruby/RubyObject.java |
||
public org.openmicroscopy.omero.model.Image getImage() { | public Image getImage() { | public org.openmicroscopy.omero.model.Image getImage() { return this.image; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayRoi.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayRoi.java |
public void setImage(org.openmicroscopy.omero.model.Image image) { | public void setImage(Image image) { | public void setImage(org.openmicroscopy.omero.model.Image image) { this.image = image; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayRoi.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayRoi.java |
public org.openmicroscopy.omero.model.ModuleExecution getModuleExecution() { | public ModuleExecution getModuleExecution() { | public org.openmicroscopy.omero.model.ModuleExecution getModuleExecution() { return this.moduleExecution; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayRoi.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayRoi.java |
public void setModuleExecution(org.openmicroscopy.omero.model.ModuleExecution moduleExecution) { | public void setModuleExecution(ModuleExecution moduleExecution) { | public void setModuleExecution(org.openmicroscopy.omero.model.ModuleExecution moduleExecution) { this.moduleExecution = moduleExecution; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayRoi.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayRoi.java |
public org.openmicroscopy.omero.model.DisplayOption getDisplayOption() { | public DisplayOption getDisplayOption() { | public org.openmicroscopy.omero.model.DisplayOption getDisplayOption() { return this.displayOption; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayRoi.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayRoi.java |
public void setDisplayOption(org.openmicroscopy.omero.model.DisplayOption displayOption) { | public void setDisplayOption(DisplayOption displayOption) { | public void setDisplayOption(org.openmicroscopy.omero.model.DisplayOption displayOption) { this.displayOption = displayOption; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/DisplayRoi.java/buggy/components/common/src/org/openmicroscopy/omero/model/DisplayRoi.java |
((RubyFixnum) arg1).setValue(((RubyFixnum) arg1).getValue() + 1); | ((RubyFixnum) arg1).setValue(RubyNumeric.fix2long(arg1) + 1); | public static RubyObject each_with_index_i(Ruby ruby, RubyObject blockArg, RubyObject arg1, RubyObject self) { ruby.yield(RubyArray.newArray(ruby, blockArg, arg1)); ((RubyFixnum) arg1).setValue(((RubyFixnum) arg1).getValue() + 1); return ruby.getNil(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/786cea08c1dd2092a02d1254b49fbee371ace5f9/RubyEnumerable.java/clean/org/jruby/RubyEnumerable.java |
throw new BreakException(); | throw new BreakJump(); | public static RubyObject find_i(Ruby ruby, RubyObject blockArg, RubyObject arg1, RubyObject self) { if (ruby.yield(blockArg).isTrue()) { ((RubyArray) arg1).push(blockArg); throw new BreakException(); } return ruby.getNil(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/786cea08c1dd2092a02d1254b49fbee371ace5f9/RubyEnumerable.java/clean/org/jruby/RubyEnumerable.java |
throw new BreakException(); | throw new BreakJump(); | public static RubyObject member_i(Ruby ruby, RubyObject blockArg, RubyObject arg1, RubyObject self) { if (blockArg.funcall("==", ((RubyArray) arg1).entry(0)).isTrue()) { ((RubyArray) arg1).push(ruby.getTrue()); throw new BreakException(); } return ruby.getNil(); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/786cea08c1dd2092a02d1254b49fbee371ace5f9/RubyEnumerable.java/clean/org/jruby/RubyEnumerable.java |
return new ReflectionCallbackMethod(type, method, new Class[] { RubyObject.class, RubyObject.class }, false, true); | return new ReflectionCallbackMethod(type, method, new Class[] { RubyObject.class, RubyObject.class }, false, true, 2); | public static Callback getBlockMethod(Class type, String method) { return new ReflectionCallbackMethod(type, method, new Class[] { RubyObject.class, RubyObject.class }, false, true); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/6076c5ab87d25a488469aa1a32f1d2c9c9e470b2/CallbackFactory.java/buggy/org/jruby/runtime/CallbackFactory.java |
double curveCoefficient, int cdStart, int cdEnd, int min, int max) { this.family = family; this.curveCoefficient = curveCoefficient; this.cdStart = cdStart; this.cdEnd = cdEnd; type = family; reverseIntensity = false; manager = new GraphicsRepresentationManager(this, control, type); setInputWindow(min, max); minimum = min; maximum = max; quad = new QuadCurve2D.Double(); startPt = new Point2D.Double(); controlPt = new Point2D.Double(); endPt = new Point2D.Double(); staticStartPt = new Point2D.Double(); staticEndPt = new Point2D.Double(); xStartMax = leftBorder; } | double curveCoefficient, int cdStart, int cdEnd, int min, int max, double[] stats) { this.family = family; this.curveCoefficient = curveCoefficient; this.cdStart = cdStart; this.cdEnd = cdEnd; this.stats = stats; type = family; reverseIntensity = false; manager = new GraphicsRepresentationManager(this, control, type); setInputWindow(min, max); minimum = min; maximum = max; quad = new QuadCurve2D.Double(); startPt = new Point2D.Double(); controlPt = new Point2D.Double(); endPt = new Point2D.Double(); staticStartPt = new Point2D.Double(); staticEndPt = new Point2D.Double(); xStartMax = leftBorder; } | GraphicsRepresentation(QuantumPaneManager control, int family, double curveCoefficient, int cdStart, int cdEnd, int min, int max) { this.family = family; this.curveCoefficient = curveCoefficient; this.cdStart = cdStart; this.cdEnd = cdEnd; type = family; reverseIntensity = false; //TODO: retrieve user settings manager = new GraphicsRepresentationManager(this, control, type); setInputWindow(min, max); minimum = min; maximum = max; quad = new QuadCurve2D.Double(); startPt = new Point2D.Double(); controlPt = new Point2D.Double(); endPt = new Point2D.Double(); staticStartPt = new Point2D.Double(); staticEndPt = new Point2D.Double(); xStartMax = leftBorder; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; g2D.setColor(getBackground()); g2D.fillRect(0, 0, width, height); Font font = g2D.getFont(); FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight(); Rectangle2D rStart = font.getStringBounds(start, g2D.getFontRenderContext()); int wStart = (int) rStart.getWidth(); int hStart = (int) rStart.getHeight(); Rectangle2D rEnd = font.getStringBounds(end, g2D.getFontRenderContext()); int wEnd = (int) rEnd.getWidth(); Rectangle2D rInput = font.getStringBounds("Pixel intensity", g2D.getFontRenderContext()); int wInput = (int) rInput.getWidth(); int hInput = (int) rInput.getHeight(); | { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; g2D.setColor(getBackground()); g2D.fillRect(0, 0, width, height); Font font = g2D.getFont(); FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight(); Rectangle2D rStart = font.getStringBounds(start, g2D.getFontRenderContext()); int wStart = (int) rStart.getWidth(); int hStart = (int) rStart.getHeight(); Rectangle2D rEnd = font.getStringBounds(end, g2D.getFontRenderContext()); int wEnd = (int) rEnd.getWidth(); Rectangle2D rInput = font.getStringBounds("Pixel intensity", g2D.getFontRenderContext()); int wInput = (int) rInput.getWidth(); int hInput = (int) rInput.getHeight(); | public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; g2D.setColor(getBackground()); g2D.fillRect(0, 0, width, height); //FONT settings. Font font = g2D.getFont(); FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight(); Rectangle2D rStart = font.getStringBounds(start, g2D.getFontRenderContext()); int wStart = (int) rStart.getWidth(); int hStart = (int) rStart.getHeight(); Rectangle2D rEnd = font.getStringBounds(end, g2D.getFontRenderContext()); int wEnd = (int) rEnd.getWidth(); Rectangle2D rInput = font.getStringBounds("Pixel intensity", g2D.getFontRenderContext()); int wInput = (int) rInput.getWidth(); int hInput = (int) rInput.getHeight(); setKnobStartY(tS+hStart+5); setKnobEndY(hStart+5); int extra = 0; if (type == QuantumFactory.EXPONENTIAL) extra = hStart/2; //Grid AffineTransform transform = new AffineTransform(); //140/10 = 14 then middle = 14/2 transform.translate(leftBorder+70, topBorder+70); transform.scale(10, 10); g2D.setPaint(Color.lightGray); GeneralPath path = new GeneralPath(); for (int i = -7; i <= 7; i++) { path.moveTo(i, -7); path.lineTo(i, 7); } for (int i = -7; i <= 7; i++) { path.moveTo(-7, i); path.lineTo(7, i); } g2D.draw(transform.createTransformedShape(path)); g2D.setColor(axisColor); //y-axis g2D.drawLine(leftBorder, topBorder-8, leftBorder, tS+5); g2D.drawLine(leftBorder, topBorder-8, leftBorder-3, topBorder-5); g2D.drawLine(leftBorder, topBorder-8, leftBorder+3, topBorder-5); g2D.drawLine(leftBorder-5, topBorder, leftBorder, topBorder); //x-axis g2D.drawLine(leftBorder-5, tS, lS+8, tS); g2D.drawLine(lS+5, tS-3, lS+8, tS); g2D.drawLine(lS+5, tS+3, lS+8, tS); g2D.drawLine(xControl, tS, xControl, tS+5); //input interval g2D.drawString(start, leftBorder-wStart/2, tS+hFont); g2D.drawString(end, xControl-wEnd/2, hFont+tS+extra); g2D.drawString("Pixels intensity", lS2-wInput/2, hFont/2+tS+bottomBorder+hInput); //g2D.drawString(curStart, 10, hFont+tS+bottomBorder+2*hInput); //g2D.drawString(curEnd, lS2+10, hFont+tS+bottomBorder+2*hInput); //inputStart knob int xStartPoints[] = {xStart1, xStart2, xStart3}; int yStartPoints[] = {yStart1+extra, yStart2+extra, yStart3+extra}; GeneralPath filledPolygonStart = new GeneralPath(); filledPolygonStart.moveTo(xStartPoints[0], yStartPoints[0]); for (int index = 1; index < xStartPoints.length; index++) filledPolygonStart.lineTo(xStartPoints[index], yStartPoints[index]); filledPolygonStart.closePath(); g2D.setColor(iStartColor); g2D.fill(filledPolygonStart); //curStart value g2D.drawString(curStart, 10, hFont+tS+bottomBorder+2*hInput); //inputEnd knob int xEndPoints[] = {xEnd1, xEnd2, xEnd3}; int yEndPoints[] = {yEnd1+extra, yEnd2+extra, yEnd3+extra}; GeneralPath filledPolygonEnd = new GeneralPath(); filledPolygonEnd.moveTo(xEndPoints[0], yEndPoints[0]); for (int index = 1; index < xEndPoints.length; index++) filledPolygonEnd.lineTo(xEndPoints[index], yEndPoints[index]); filledPolygonEnd.closePath(); g2D.setColor(iEndColor); g2D.fill(filledPolygonEnd); //curEnd value. g2D.drawString(curEnd, lS2+10, hFont+tS+bottomBorder+2*hInput); //outputStart knob int xStartOutputPoints[] = {xStartOutput1, xStartOutput2, xStartOutput3}; int yStartOutputPoints[] = {yStartOutput1, yStartOutput2, yStartOutput3}; GeneralPath filledPolygonStartOutput = new GeneralPath(); filledPolygonStartOutput.moveTo(xStartOutputPoints[0], yStartOutputPoints[0]); for (int index = 1; index < xStartOutputPoints.length; index++) filledPolygonStartOutput.lineTo(xStartOutputPoints[index], yStartOutputPoints[index]); filledPolygonStartOutput.closePath(); g2D.setColor(ostartColor); g2D.fill(filledPolygonStartOutput); //outputEnd knob. int xEndOutputPoints[] = {xEndOutput1, xEndOutput2, xEndOutput3}; int yEndOutputPoints[] = {yEndOutput1, yEndOutput2, yEndOutput3}; GeneralPath filledPolygonEndOutput = new GeneralPath(); filledPolygonEndOutput.moveTo(xEndOutputPoints[0], yEndOutputPoints[0]); for (int index = 1; index < xEndOutputPoints.length; index++) filledPolygonEndOutput.lineTo(xEndOutputPoints[index], yEndOutputPoints[index]); filledPolygonEndOutput.closePath(); g2D.setColor(oendColor); g2D.fill(filledPolygonEndOutput); g2D.setColor(lineColor); g2D.setStroke(new BasicStroke(1.5f)); //draw line g2D.drawLine((int) staticStartPt.getX(), (int) staticStartPt.getY(), (int) startPt.getX(), (int) startPt.getY()); g2D.drawLine((int) endPt.getX(), (int) endPt.getY(), (int) staticEndPt.getX(), (int) staticEndPt.getY()); //draw curve g2D.draw(quad); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
int extra = 0; if (type == QuantumFactory.EXPONENTIAL) extra = hStart/2; AffineTransform transform = new AffineTransform(); transform.translate(leftBorder+70, topBorder+70); transform.scale(10, 10); g2D.setPaint(Color.lightGray); GeneralPath path = new GeneralPath(); for (int i = -7; i <= 7; i++) { path.moveTo(i, -7); path.lineTo(i, 7); } for (int i = -7; i <= 7; i++) { path.moveTo(-7, i); path.lineTo(7, i); } g2D.draw(transform.createTransformedShape(path)); g2D.setColor(axisColor); g2D.drawLine(leftBorder, topBorder-8, leftBorder, tS+5); g2D.drawLine(leftBorder, topBorder-8, leftBorder-3, topBorder-5); g2D.drawLine(leftBorder, topBorder-8, leftBorder+3, topBorder-5); g2D.drawLine(leftBorder-5, topBorder, leftBorder, topBorder); g2D.drawLine(leftBorder-5, tS, lS+8, tS); g2D.drawLine(lS+5, tS-3, lS+8, tS); g2D.drawLine(lS+5, tS+3, lS+8, tS); g2D.drawLine(xControl, tS, xControl, tS+5); g2D.drawString(start, leftBorder-wStart/2, tS+hFont); g2D.drawString(end, xControl-wEnd/2, hFont+tS+extra); g2D.drawString("Pixels intensity", lS2-wInput/2, hFont/2+tS+bottomBorder+hInput); int xStartPoints[] = {xStart1, xStart2, xStart3}; int yStartPoints[] = {yStart1+extra, yStart2+extra, yStart3+extra}; GeneralPath filledPolygonStart = new GeneralPath(); filledPolygonStart.moveTo(xStartPoints[0], yStartPoints[0]); for (int index = 1; index < xStartPoints.length; index++) filledPolygonStart.lineTo(xStartPoints[index], yStartPoints[index]); filledPolygonStart.closePath(); g2D.setColor(iStartColor); g2D.fill(filledPolygonStart); g2D.drawString(curStart, 10, hFont+tS+bottomBorder+2*hInput); int xEndPoints[] = {xEnd1, xEnd2, xEnd3}; int yEndPoints[] = {yEnd1+extra, yEnd2+extra, yEnd3+extra}; GeneralPath filledPolygonEnd = new GeneralPath(); filledPolygonEnd.moveTo(xEndPoints[0], yEndPoints[0]); for (int index = 1; index < xEndPoints.length; index++) filledPolygonEnd.lineTo(xEndPoints[index], yEndPoints[index]); filledPolygonEnd.closePath(); g2D.setColor(iEndColor); g2D.fill(filledPolygonEnd); g2D.drawString(curEnd, lS2+10, hFont+tS+bottomBorder+2*hInput); int xStartOutputPoints[] = {xStartOutput1, xStartOutput2, xStartOutput3}; int yStartOutputPoints[] = {yStartOutput1, yStartOutput2, yStartOutput3}; GeneralPath filledPolygonStartOutput = new GeneralPath(); filledPolygonStartOutput.moveTo(xStartOutputPoints[0], yStartOutputPoints[0]); for (int index = 1; index < xStartOutputPoints.length; index++) filledPolygonStartOutput.lineTo(xStartOutputPoints[index], yStartOutputPoints[index]); filledPolygonStartOutput.closePath(); g2D.setColor(ostartColor); g2D.fill(filledPolygonStartOutput); int xEndOutputPoints[] = {xEndOutput1, xEndOutput2, xEndOutput3}; int yEndOutputPoints[] = {yEndOutput1, yEndOutput2, yEndOutput3}; GeneralPath filledPolygonEndOutput = new GeneralPath(); filledPolygonEndOutput.moveTo(xEndOutputPoints[0], yEndOutputPoints[0]); for (int index = 1; index < xEndOutputPoints.length; index++) filledPolygonEndOutput.lineTo(xEndOutputPoints[index], yEndOutputPoints[index]); filledPolygonEndOutput.closePath(); g2D.setColor(oendColor); g2D.fill(filledPolygonEndOutput); g2D.setColor(lineColor); g2D.setStroke(new BasicStroke(1.5f)); g2D.drawLine((int) staticStartPt.getX(), (int) staticStartPt.getY(), (int) startPt.getX(), (int) startPt.getY()); g2D.drawLine((int) endPt.getX(), (int) endPt.getY(), (int) staticEndPt.getX(), (int) staticEndPt.getY()); g2D.draw(quad); } | int extra = 0; if (type == QuantumFactory.EXPONENTIAL) extra = hStart/2; if (stats == null) paintGrid(g2D); else paintBins(g2D); g2D.setColor(axisColor); g2D.drawLine(leftBorder, topBorder-8, leftBorder, tS+5); g2D.drawLine(leftBorder, topBorder-8, leftBorder-3, topBorder-5); g2D.drawLine(leftBorder, topBorder-8, leftBorder+3, topBorder-5); g2D.drawLine(leftBorder-5, topBorder, leftBorder, topBorder); g2D.drawLine(leftBorder-5, tS, lS+8, tS); g2D.drawLine(lS+5, tS-3, lS+8, tS); g2D.drawLine(lS+5, tS+3, lS+8, tS); g2D.drawLine(xControl, tS, xControl, tS+5); g2D.drawString(start, leftBorder-wStart/2, tS+hFont); g2D.drawString(end, xControl-wEnd/2, hFont+tS+extra); g2D.drawString("Pixels intensity", lS2-wInput/2, hFont/2+tS+bottomBorder+hInput); int xStartPoints[] = {xStart1, xStart2, xStart3}; int yStartPoints[] = {yStart1+extra, yStart2+extra, yStart3+extra}; GeneralPath filledPolygonStart = new GeneralPath(); filledPolygonStart.moveTo(xStartPoints[0], yStartPoints[0]); for (int index = 1; index < xStartPoints.length; index++) filledPolygonStart.lineTo(xStartPoints[index], yStartPoints[index]); filledPolygonStart.closePath(); g2D.setColor(iStartColor); g2D.fill(filledPolygonStart); g2D.drawString(curStart, 10, hFont+tS+bottomBorder+2*hInput); int xEndPoints[] = {xEnd1, xEnd2, xEnd3}; int yEndPoints[] = {yEnd1+extra, yEnd2+extra, yEnd3+extra}; GeneralPath filledPolygonEnd = new GeneralPath(); filledPolygonEnd.moveTo(xEndPoints[0], yEndPoints[0]); for (int index = 1; index < xEndPoints.length; index++) filledPolygonEnd.lineTo(xEndPoints[index], yEndPoints[index]); filledPolygonEnd.closePath(); g2D.setColor(iEndColor); g2D.fill(filledPolygonEnd); g2D.drawString(curEnd, lS2+10, hFont+tS+bottomBorder+2*hInput); int xStartOutputPoints[] = {xStartOutput1, xStartOutput2, xStartOutput3}; int yStartOutputPoints[] = {yStartOutput1, yStartOutput2, yStartOutput3}; GeneralPath filledPolygonStartOutput = new GeneralPath(); filledPolygonStartOutput.moveTo(xStartOutputPoints[0], yStartOutputPoints[0]); for (int index = 1; index < xStartOutputPoints.length; index++) filledPolygonStartOutput.lineTo(xStartOutputPoints[index], yStartOutputPoints[index]); filledPolygonStartOutput.closePath(); g2D.setColor(ostartColor); g2D.fill(filledPolygonStartOutput); int xEndOutputPoints[] = {xEndOutput1, xEndOutput2, xEndOutput3}; int yEndOutputPoints[] = {yEndOutput1, yEndOutput2, yEndOutput3}; GeneralPath filledPolygonEndOutput = new GeneralPath(); filledPolygonEndOutput.moveTo(xEndOutputPoints[0], yEndOutputPoints[0]); for (int index = 1; index < xEndOutputPoints.length; index++) filledPolygonEndOutput.lineTo(xEndOutputPoints[index], yEndOutputPoints[index]); filledPolygonEndOutput.closePath(); g2D.setColor(oendColor); g2D.fill(filledPolygonEndOutput); g2D.setColor(lineColor); g2D.setStroke(new BasicStroke(1.5f)); g2D.drawLine((int) staticStartPt.getX(), (int) staticStartPt.getY(), (int) startPt.getX(), (int) startPt.getY()); g2D.drawLine((int) endPt.getX(), (int) endPt.getY(), (int) staticEndPt.getX(), (int) staticEndPt.getY()); g2D.draw(quad); } | public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; g2D.setColor(getBackground()); g2D.fillRect(0, 0, width, height); //FONT settings. Font font = g2D.getFont(); FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight(); Rectangle2D rStart = font.getStringBounds(start, g2D.getFontRenderContext()); int wStart = (int) rStart.getWidth(); int hStart = (int) rStart.getHeight(); Rectangle2D rEnd = font.getStringBounds(end, g2D.getFontRenderContext()); int wEnd = (int) rEnd.getWidth(); Rectangle2D rInput = font.getStringBounds("Pixel intensity", g2D.getFontRenderContext()); int wInput = (int) rInput.getWidth(); int hInput = (int) rInput.getHeight(); setKnobStartY(tS+hStart+5); setKnobEndY(hStart+5); int extra = 0; if (type == QuantumFactory.EXPONENTIAL) extra = hStart/2; //Grid AffineTransform transform = new AffineTransform(); //140/10 = 14 then middle = 14/2 transform.translate(leftBorder+70, topBorder+70); transform.scale(10, 10); g2D.setPaint(Color.lightGray); GeneralPath path = new GeneralPath(); for (int i = -7; i <= 7; i++) { path.moveTo(i, -7); path.lineTo(i, 7); } for (int i = -7; i <= 7; i++) { path.moveTo(-7, i); path.lineTo(7, i); } g2D.draw(transform.createTransformedShape(path)); g2D.setColor(axisColor); //y-axis g2D.drawLine(leftBorder, topBorder-8, leftBorder, tS+5); g2D.drawLine(leftBorder, topBorder-8, leftBorder-3, topBorder-5); g2D.drawLine(leftBorder, topBorder-8, leftBorder+3, topBorder-5); g2D.drawLine(leftBorder-5, topBorder, leftBorder, topBorder); //x-axis g2D.drawLine(leftBorder-5, tS, lS+8, tS); g2D.drawLine(lS+5, tS-3, lS+8, tS); g2D.drawLine(lS+5, tS+3, lS+8, tS); g2D.drawLine(xControl, tS, xControl, tS+5); //input interval g2D.drawString(start, leftBorder-wStart/2, tS+hFont); g2D.drawString(end, xControl-wEnd/2, hFont+tS+extra); g2D.drawString("Pixels intensity", lS2-wInput/2, hFont/2+tS+bottomBorder+hInput); //g2D.drawString(curStart, 10, hFont+tS+bottomBorder+2*hInput); //g2D.drawString(curEnd, lS2+10, hFont+tS+bottomBorder+2*hInput); //inputStart knob int xStartPoints[] = {xStart1, xStart2, xStart3}; int yStartPoints[] = {yStart1+extra, yStart2+extra, yStart3+extra}; GeneralPath filledPolygonStart = new GeneralPath(); filledPolygonStart.moveTo(xStartPoints[0], yStartPoints[0]); for (int index = 1; index < xStartPoints.length; index++) filledPolygonStart.lineTo(xStartPoints[index], yStartPoints[index]); filledPolygonStart.closePath(); g2D.setColor(iStartColor); g2D.fill(filledPolygonStart); //curStart value g2D.drawString(curStart, 10, hFont+tS+bottomBorder+2*hInput); //inputEnd knob int xEndPoints[] = {xEnd1, xEnd2, xEnd3}; int yEndPoints[] = {yEnd1+extra, yEnd2+extra, yEnd3+extra}; GeneralPath filledPolygonEnd = new GeneralPath(); filledPolygonEnd.moveTo(xEndPoints[0], yEndPoints[0]); for (int index = 1; index < xEndPoints.length; index++) filledPolygonEnd.lineTo(xEndPoints[index], yEndPoints[index]); filledPolygonEnd.closePath(); g2D.setColor(iEndColor); g2D.fill(filledPolygonEnd); //curEnd value. g2D.drawString(curEnd, lS2+10, hFont+tS+bottomBorder+2*hInput); //outputStart knob int xStartOutputPoints[] = {xStartOutput1, xStartOutput2, xStartOutput3}; int yStartOutputPoints[] = {yStartOutput1, yStartOutput2, yStartOutput3}; GeneralPath filledPolygonStartOutput = new GeneralPath(); filledPolygonStartOutput.moveTo(xStartOutputPoints[0], yStartOutputPoints[0]); for (int index = 1; index < xStartOutputPoints.length; index++) filledPolygonStartOutput.lineTo(xStartOutputPoints[index], yStartOutputPoints[index]); filledPolygonStartOutput.closePath(); g2D.setColor(ostartColor); g2D.fill(filledPolygonStartOutput); //outputEnd knob. int xEndOutputPoints[] = {xEndOutput1, xEndOutput2, xEndOutput3}; int yEndOutputPoints[] = {yEndOutput1, yEndOutput2, yEndOutput3}; GeneralPath filledPolygonEndOutput = new GeneralPath(); filledPolygonEndOutput.moveTo(xEndOutputPoints[0], yEndOutputPoints[0]); for (int index = 1; index < xEndOutputPoints.length; index++) filledPolygonEndOutput.lineTo(xEndOutputPoints[index], yEndOutputPoints[index]); filledPolygonEndOutput.closePath(); g2D.setColor(oendColor); g2D.fill(filledPolygonEndOutput); g2D.setColor(lineColor); g2D.setStroke(new BasicStroke(1.5f)); //draw line g2D.drawLine((int) staticStartPt.getX(), (int) staticStartPt.getY(), (int) startPt.getX(), (int) startPt.getY()); g2D.drawLine((int) endPt.getX(), (int) endPt.getY(), (int) staticEndPt.getX(), (int) staticEndPt.getY()); //draw curve g2D.draw(quad); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ quad.setCurve(startPt, controlPt, endPt); repaint(); } | { quad.setCurve(startPt, controlPt, endPt); repaint(); } | private void repaintCurve() { quad.setCurve(startPt, controlPt, endPt); repaint(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ double yStart, yEnd; double xStaticStart, xStart; reverseIntensity = b; yEnd = endPt.getY(); yStart = startPt.getY(); setKnobOutputStart((int) yStart); setKnobOutputEnd((int) yEnd); manager.setOutputRectangles((int) yStart, (int) yEnd); xStaticStart = staticStartPt.getX(); xStart = startPt.getX(); startPt.setLocation(endPt.getX(), yStart); endPt.setLocation(xStart, yEnd); if (reverseIntensity) { if (type == QuantumFactory.EXPONENTIAL) { staticStartPt.setLocation(staticEndPt.getX(), yStart); staticEndPt.setLocation(xStaticStart, yEnd); controlPt.setLocation(controlPt.getX(), yEnd); repaintCurve(); } else { staticStartPt.setLocation(lS, yStart); staticEndPt.setLocation(leftBorder, yEnd); setControlLocation(coefficient); } } else { if (type == QuantumFactory.EXPONENTIAL) { staticStartPt.setLocation(staticEndPt.getX(), yStart); staticEndPt.setLocation(xStaticStart, yEnd); controlPt.setLocation(controlPt.getX(), yStart); repaintCurve(); } else { staticStartPt.setLocation(leftBorder, yStart); staticEndPt.setLocation(lS, yEnd); setControlLocation(coefficient); } } } | { double yStart, yEnd; double xStaticStart, xStart; reverseIntensity = b; yEnd = endPt.getY(); yStart = startPt.getY(); setKnobOutputStart((int) yStart); setKnobOutputEnd((int) yEnd); manager.setOutputRectangles((int) yStart, (int) yEnd); xStaticStart = staticStartPt.getX(); xStart = startPt.getX(); startPt.setLocation(endPt.getX(), yStart); endPt.setLocation(xStart, yEnd); if (reverseIntensity) { if (type == QuantumFactory.EXPONENTIAL) { staticStartPt.setLocation(staticEndPt.getX(), yStart); staticEndPt.setLocation(xStaticStart, yEnd); controlPt.setLocation(controlPt.getX(), yEnd); repaintCurve(); } else { staticStartPt.setLocation(lS, yStart); staticEndPt.setLocation(leftBorder, yEnd); setControlLocation(coefficient); } } else { if (type == QuantumFactory.EXPONENTIAL) { staticStartPt.setLocation(staticEndPt.getX(), yStart); staticEndPt.setLocation(xStaticStart, yEnd); controlPt.setLocation(controlPt.getX(), yStart); repaintCurve(); } else { staticStartPt.setLocation(leftBorder, yStart); staticEndPt.setLocation(lS, yEnd); setControlLocation(coefficient); } } } | void reverse(boolean b) { double yStart, yEnd; double xStaticStart, xStart; reverseIntensity = b; yEnd = endPt.getY(); yStart = startPt.getY(); setKnobOutputStart((int) yStart); setKnobOutputEnd((int) yEnd); manager.setOutputRectangles((int) yStart, (int) yEnd); xStaticStart = staticStartPt.getX(); xStart = startPt.getX(); startPt.setLocation(endPt.getX(), yStart); endPt.setLocation(xStart, yEnd); if (reverseIntensity) { if (type == QuantumFactory.EXPONENTIAL) { staticStartPt.setLocation(staticEndPt.getX(), yStart); staticEndPt.setLocation(xStaticStart, yEnd); controlPt.setLocation(controlPt.getX(), yEnd); repaintCurve(); } else { staticStartPt.setLocation(lS, yStart); staticEndPt.setLocation(leftBorder, yEnd); setControlLocation(coefficient); } } else { if (type == QuantumFactory.EXPONENTIAL) { staticStartPt.setLocation(staticEndPt.getX(), yStart); staticEndPt.setLocation(xStaticStart, yEnd); controlPt.setLocation(controlPt.getX(), yStart); repaintCurve(); } else { staticStartPt.setLocation(leftBorder, yStart); staticEndPt.setLocation(lS, yEnd); setControlLocation(coefficient); } } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ double x = 0; double diffEnd; coefficient = k; if (k == INIT) { if (reverseIntensity) x = (staticEndPt.getX()+square/2); else x = (staticStartPt.getX()+square/2); } else if (MIN <= k && k < INIT) { k = INIT-k; if (reverseIntensity) x = (staticEndPt.getX()+square/2+k*binMax); else x = (staticStartPt.getX()+square/2+k*binMax); } else if (k > INIT && k <= MAX) { k = k-INIT; if (reverseIntensity) x = (staticEndPt.getX()+square/2-k*binMin); else x = (staticStartPt.getX()+square/2-k*binMin); } xControl = (int) x; if (x >= xStartMax+triangleW) { if (reverseIntensity) { diffEnd = staticStartPt.getX()-startPt.getX(); startPt.setLocation(x-diffEnd, startPt.getY()); controlPt.setLocation(x-diffEnd, endPt.getY()); staticStartPt.setLocation(x, staticStartPt.getY()); manager.setInputEndBox((int) (x-diffEnd)); setKnobEnd((int) (x-diffEnd)); } else { diffEnd = staticEndPt.getX()-endPt.getX(); endPt.setLocation(x-diffEnd, endPt.getY()); controlPt.setLocation(x-diffEnd, startPt.getY()); staticEndPt.setLocation(x, staticEndPt.getY()); manager.setInputEndBox((int) (x-diffEnd)); setKnobEnd((int) (x-diffEnd)); } range = (int) x-leftBorder; manager.setMaxEndX(xControl); repaintCurve(); } } | { double x = 0; double diffEnd; coefficient = k; if (k == INIT) { if (reverseIntensity) x = (staticEndPt.getX()+square/2); else x = (staticStartPt.getX()+square/2); } else if (MIN <= k && k < INIT) { k = INIT-k; if (reverseIntensity) x = (staticEndPt.getX()+square/2+k*binMax); else x = (staticStartPt.getX()+square/2+k*binMax); } else if (k > INIT && k <= MAX) { k = k-INIT; if (reverseIntensity) x = (staticEndPt.getX()+square/2-k*binMin); else x = (staticStartPt.getX()+square/2-k*binMin); } xControl = (int) x; if (x >= xStartMax+triangleW) { if (reverseIntensity) { diffEnd = staticStartPt.getX()-startPt.getX(); startPt.setLocation(x-diffEnd, startPt.getY()); controlPt.setLocation(x-diffEnd, endPt.getY()); staticStartPt.setLocation(x, staticStartPt.getY()); manager.setInputEndBox((int) (x-diffEnd)); setKnobEnd((int) (x-diffEnd)); } else { diffEnd = staticEndPt.getX()-endPt.getX(); endPt.setLocation(x-diffEnd, endPt.getY()); controlPt.setLocation(x-diffEnd, startPt.getY()); staticEndPt.setLocation(x, staticEndPt.getY()); manager.setInputEndBox((int) (x-diffEnd)); setKnobEnd((int) (x-diffEnd)); } range = (int) x-leftBorder; manager.setMaxEndX(xControl); repaintCurve(); } } | void setControlAndEndLocation(int k) { double x = 0; double diffEnd; coefficient = k; if (k == INIT) { if (reverseIntensity) x = (staticEndPt.getX()+square/2); else x = (staticStartPt.getX()+square/2); } else if (MIN <= k && k < INIT) { k = INIT-k; if (reverseIntensity) x = (staticEndPt.getX()+square/2+k*binMax); else x = (staticStartPt.getX()+square/2+k*binMax); } else if (k > INIT && k <= MAX) { k = k-INIT; if (reverseIntensity) x = (staticEndPt.getX()+square/2-k*binMin); else x = (staticStartPt.getX()+square/2-k*binMin); } xControl = (int) x; if (x >= xStartMax+triangleW) { if (reverseIntensity) { diffEnd = staticStartPt.getX()-startPt.getX(); startPt.setLocation(x-diffEnd, startPt.getY()); controlPt.setLocation(x-diffEnd, endPt.getY()); staticStartPt.setLocation(x, staticStartPt.getY()); manager.setInputEndBox((int) (x-diffEnd)); setKnobEnd((int) (x-diffEnd)); } else { diffEnd = staticEndPt.getX()-endPt.getX(); endPt.setLocation(x-diffEnd, endPt.getY()); controlPt.setLocation(x-diffEnd, startPt.getY()); staticEndPt.setLocation(x, staticEndPt.getY()); manager.setInputEndBox((int) (x-diffEnd)); setKnobEnd((int) (x-diffEnd)); } range = (int) x-leftBorder; manager.setMaxEndX(xControl); repaintCurve(); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ double x = 0, y = 0; coefficient = k; double diff; if (reverseIntensity) diff = startPt.getX()-endPt.getX(); else diff = endPt.getX()-startPt.getX(); binMin = (int) (diff/rangeMin); binMax = (int) (diff/rangeMax); if (k == INIT) { x = startPt.getX(); y = startPt.getY(); } else if (MIN <= k && k < INIT) { if (reverseIntensity) { x = endPt.getX()+(k-1)*binMin; y = startPt.getY(); } else { x = startPt.getX() + (k-1)*binMin; y = endPt.getY(); } } else if (k > INIT && k <= MAX) { if (reverseIntensity) { x = endPt.getX()+(k-INIT)*binMax; y = endPt.getY(); } else { x = startPt.getX()+(k-INIT)*binMax; y = startPt.getY(); } } controlPt.setLocation(x, y); repaintCurve(); } | { double x = 0, y = 0; coefficient = k; double diff; if (reverseIntensity) diff = startPt.getX()-endPt.getX(); else diff = endPt.getX()-startPt.getX(); binMin = (int) (diff/rangeMin); binMax = (int) (diff/rangeMax); if (k == INIT) { x = startPt.getX(); y = startPt.getY(); } else if (MIN <= k && k < INIT) { if (reverseIntensity) { x = endPt.getX()+(k-1)*binMin; y = startPt.getY(); } else { x = startPt.getX() + (k-1)*binMin; y = endPt.getY(); } } else if (k > INIT && k <= MAX) { if (reverseIntensity) { x = endPt.getX()+(k-INIT)*binMax; y = endPt.getY(); } else { x = startPt.getX()+(k-INIT)*binMax; y = startPt.getY(); } } controlPt.setLocation(x, y); repaintCurve(); } | void setControlLocation(int k) { double x = 0, y = 0; coefficient = k; double diff; if (reverseIntensity) diff = startPt.getX()-endPt.getX(); else diff = endPt.getX()-startPt.getX(); binMin = (int) (diff/rangeMin); binMax = (int) (diff/rangeMax); if (k == INIT) { x = startPt.getX(); y = startPt.getY(); } else if (MIN <= k && k < INIT) { if (reverseIntensity) { x = endPt.getX()+(k-1)*binMin; y = startPt.getY(); } else { x = startPt.getX() + (k-1)*binMin; y = endPt.getY(); } } else if (k > INIT && k <= MAX) { if (reverseIntensity) { x = endPt.getX()+(k-INIT)*binMax; y = endPt.getY(); } else { x = startPt.getX()+(k-INIT)*binMax; y = startPt.getY(); } } controlPt.setLocation(x, y); repaintCurve(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ type = t; double xStaticEnd, xStaticStart, xEnd, xStart; xStaticEnd = 0; xStaticStart = 0; xEnd = 0; xStart = 0; if (type == QuantumFactory.EXPONENTIAL) { xControl = lS2; range = square/2; binMin = ((square-40)/(2*rangeMinExpo)); binMax = ((square-40)/(2*rangeMaxExpo)); if (reverseIntensity) { xStaticStart = lS2; xStaticEnd = leftBorder; xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; } else { xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; xStaticEnd = lS2; xStaticStart = leftBorder; } } else { xControl = lS; range = square; double a; binMin = (square/rangeMin); binMax = (square/rangeMax); if (reverseIntensity) { a = square/(staticStartPt.getX()-leftBorder); xStaticStart = lS; xStaticEnd = leftBorder; xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; } else { a = square/(staticEndPt.getX()-leftBorder); xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; xStaticEnd = lS; xStaticStart = leftBorder; } } manager.setType(type, xControl); staticEndPt.setLocation(xStaticEnd, staticEndPt.getY()); staticStartPt.setLocation(xStaticStart, staticStartPt.getY()); endPt.setLocation(xEnd, endPt.getY()); startPt.setLocation(xStart, startPt.getY()); if (reverseIntensity) { setKnobStart((int) xEnd); setKnobEnd((int) xStart); manager.setInputRectangles((int) xEnd, (int) xStart); } else { setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); } } | { type = t; double xStaticEnd, xStaticStart, xEnd, xStart; xStaticEnd = 0; xStaticStart = 0; xEnd = 0; xStart = 0; if (type == QuantumFactory.EXPONENTIAL) { xControl = lS2; range = square/2; binMin = ((square-40)/(2*rangeMinExpo)); binMax = ((square-40)/(2*rangeMaxExpo)); if (reverseIntensity) { xStaticStart = lS2; xStaticEnd = leftBorder; xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; } else { xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; xStaticEnd = lS2; xStaticStart = leftBorder; } } else { xControl = lS; range = square; double a; binMin = (square/rangeMin); binMax = (square/rangeMax); if (reverseIntensity) { a = square/(staticStartPt.getX()-leftBorder); xStaticStart = lS; xStaticEnd = leftBorder; xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; } else { a = square/(staticEndPt.getX()-leftBorder); xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; xStaticEnd = lS; xStaticStart = leftBorder; } } manager.setType(type, xControl); staticEndPt.setLocation(xStaticEnd, staticEndPt.getY()); staticStartPt.setLocation(xStaticStart, staticStartPt.getY()); endPt.setLocation(xEnd, endPt.getY()); startPt.setLocation(xStart, startPt.getY()); if (reverseIntensity) { setKnobStart((int) xEnd); setKnobEnd((int) xStart); manager.setInputRectangles((int) xEnd, (int) xStart); } else { setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); } } | void setControlsPoints(int t) { type = t; double xStaticEnd, xStaticStart, xEnd, xStart; xStaticEnd = 0; xStaticStart = 0; xEnd = 0; xStart = 0; if (type == QuantumFactory.EXPONENTIAL) { xControl = lS2; range = square/2; binMin = ((square-40)/(2*rangeMinExpo)); binMax = ((square-40)/(2*rangeMaxExpo)); if (reverseIntensity) { xStaticStart = lS2; xStaticEnd = leftBorder; xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; } else { xEnd = (endPt.getX()+leftBorder)/2; xStart = (startPt.getX()+leftBorder)/2; xStaticEnd = lS2; xStaticStart = leftBorder; } } else { xControl = lS; range = square; double a; binMin = (square/rangeMin); binMax = (square/rangeMax); if (reverseIntensity) { a = square/(staticStartPt.getX()-leftBorder); xStaticStart = lS; xStaticEnd = leftBorder; xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; } else { a = square/(staticEndPt.getX()-leftBorder); xEnd = a*(endPt.getX()-leftBorder)+leftBorder; xStart = a*(startPt.getX()-leftBorder)+leftBorder; xStaticEnd = lS; xStaticStart = leftBorder; } } manager.setType(type, xControl); staticEndPt.setLocation(xStaticEnd, staticEndPt.getY()); staticStartPt.setLocation(xStaticStart, staticStartPt.getY()); endPt.setLocation(xEnd, endPt.getY()); startPt.setLocation(xStart, startPt.getY()); //Set knob location if (reverseIntensity) { setKnobStart((int) xEnd); setKnobEnd((int) xStart); manager.setInputRectangles((int) xEnd, (int) xStart); } else { setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ curStart = "start: "+s; curEnd = "end: "+e; } | { curStart = "start: "+s; curEnd = "end: "+e; } | private void setCurrentInputs(int s, int e) { curStart = "start: "+s; curEnd = "end: "+e; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ setCurrentInputs(inputStart, inputEnd); int k = (int) (curveCoefficient*10); binMin = ((square-40)/(2*rangeMinExpo)); binMax = ((square-40)/(2*rangeMaxExpo)); double yStart, yEnd, xStart, xEnd, xStaticStart, xStaticEnd; xStaticStart = 0; xStaticEnd = 0; yStart = setOuputGraphics(cdStart); yEnd = setOuputGraphics(cdEnd); setKnobOutputStart(leftBorder-10,(int) yStart); | { setCurrentInputs(inputStart, inputEnd); int k = (int) (curveCoefficient*10); binMin = ((square-40)/(2*rangeMinExpo)); binMax = ((square-40)/(2*rangeMaxExpo)); double yStart, yEnd, xStart, xEnd, xStaticStart, xStaticEnd; xStaticStart = 0; xStaticEnd = 0; yStart = setOuputGraphics(cdStart); yEnd = setOuputGraphics(cdEnd); setKnobOutputStart(leftBorder-10,(int) yStart); | void setDefaultExponential(int inputStart, int inputEnd) { setCurrentInputs(inputStart, inputEnd); int k = (int) (curveCoefficient*10); binMin = ((square-40)/(2*rangeMinExpo)); binMax = ((square-40)/(2*rangeMaxExpo)); double yStart, yEnd, xStart, xEnd, xStaticStart, xStaticEnd; xStaticStart = 0; xStaticEnd = 0; yStart = setOuputGraphics(cdStart); yEnd = setOuputGraphics(cdEnd); //output knob setKnobOutputStart(leftBorder-10,(int) yStart); //setKnobOutputEnd(leftBorder-10, topBorder); setKnobOutputEnd(lS+10, topBorder); manager.setOutputRectangles((int) yStart, (int) yEnd); if (k == INIT) { if (reverseIntensity) { xStaticStart = lS2; xStaticEnd = leftBorder; range = (int) xStaticStart-leftBorder; } else { xStaticStart = leftBorder; xStaticEnd = lS2; range = (int) xStaticEnd-leftBorder; } } else if (MIN <= k && k < INIT) { k = INIT-k; if (reverseIntensity) { xStaticEnd = leftBorder; xStaticStart = (lS2+k*binMax); range = (int) xStaticStart-leftBorder; } else { xStaticEnd = (lS2+k*binMax); xStaticStart = leftBorder; range = (int) xStaticEnd-leftBorder; } } else if (k > INIT && k <= MAX) { k = k-INIT; if (reverseIntensity) { xStaticStart = (lS-k*binMin); xStaticEnd = leftBorder; if (xStaticStart < leftBorder+20) xStaticStart = leftBorder+20; range = (int) xStaticStart-leftBorder; } else { xStaticEnd = (lS-k*binMin); xStaticStart = leftBorder; if (xStaticEnd < leftBorder+20) xStaticEnd = leftBorder+20; range = (int) xStaticEnd-leftBorder; } } staticStartPt.setLocation(xStaticStart, yStart); staticEndPt.setLocation(xStaticEnd, yEnd); xStart = setInputGraphics(inputStart, range); xEnd = setInputGraphics(inputEnd, range); setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); if (reverseIntensity) { xControl = (int) xStaticStart; controlPt.setLocation(xEnd, yEnd); startPt.setLocation(xEnd, yStart); endPt.setLocation(xStart, yEnd); } else { xControl = (int) xStaticEnd; controlPt.setLocation(xEnd, yStart); startPt.setLocation(xStart, yStart); endPt.setLocation(xEnd, yEnd); } manager.setMaxEndX(xControl); repaintCurve(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
manager.setOutputRectangles((int) yStart, (int) yEnd); if (k == INIT) { if (reverseIntensity) { xStaticStart = lS2; xStaticEnd = leftBorder; range = (int) xStaticStart-leftBorder; } else { xStaticStart = leftBorder; xStaticEnd = lS2; range = (int) xStaticEnd-leftBorder; } } else if (MIN <= k && k < INIT) { k = INIT-k; if (reverseIntensity) { xStaticEnd = leftBorder; xStaticStart = (lS2+k*binMax); range = (int) xStaticStart-leftBorder; } else { xStaticEnd = (lS2+k*binMax); xStaticStart = leftBorder; range = (int) xStaticEnd-leftBorder; } } else if (k > INIT && k <= MAX) { k = k-INIT; if (reverseIntensity) { xStaticStart = (lS-k*binMin); xStaticEnd = leftBorder; if (xStaticStart < leftBorder+20) xStaticStart = leftBorder+20; range = (int) xStaticStart-leftBorder; } else { xStaticEnd = (lS-k*binMin); xStaticStart = leftBorder; if (xStaticEnd < leftBorder+20) xStaticEnd = leftBorder+20; range = (int) xStaticEnd-leftBorder; } } staticStartPt.setLocation(xStaticStart, yStart); staticEndPt.setLocation(xStaticEnd, yEnd); xStart = setInputGraphics(inputStart, range); xEnd = setInputGraphics(inputEnd, range); setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); if (reverseIntensity) { xControl = (int) xStaticStart; controlPt.setLocation(xEnd, yEnd); startPt.setLocation(xEnd, yStart); endPt.setLocation(xStart, yEnd); } else { xControl = (int) xStaticEnd; controlPt.setLocation(xEnd, yStart); startPt.setLocation(xStart, yStart); endPt.setLocation(xEnd, yEnd); } manager.setMaxEndX(xControl); repaintCurve(); } | manager.setOutputRectangles((int) yStart, (int) yEnd); if (k == INIT) { if (reverseIntensity) { xStaticStart = lS2; xStaticEnd = leftBorder; range = (int) xStaticStart-leftBorder; } else { xStaticStart = leftBorder; xStaticEnd = lS2; range = (int) xStaticEnd-leftBorder; } } else if (MIN <= k && k < INIT) { k = INIT-k; if (reverseIntensity) { xStaticEnd = leftBorder; xStaticStart = (lS2+k*binMax); range = (int) xStaticStart-leftBorder; } else { xStaticEnd = (lS2+k*binMax); xStaticStart = leftBorder; range = (int) xStaticEnd-leftBorder; } } else if (k > INIT && k <= MAX) { k = k-INIT; if (reverseIntensity) { xStaticStart = (lS-k*binMin); xStaticEnd = leftBorder; if (xStaticStart < leftBorder+20) xStaticStart = leftBorder+20; range = (int) xStaticStart-leftBorder; } else { xStaticEnd = (lS-k*binMin); xStaticStart = leftBorder; if (xStaticEnd < leftBorder+20) xStaticEnd = leftBorder+20; range = (int) xStaticEnd-leftBorder; } } staticStartPt.setLocation(xStaticStart, yStart); staticEndPt.setLocation(xStaticEnd, yEnd); xStart = setInputGraphics(inputStart, range); xEnd = setInputGraphics(inputEnd, range); setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); if (reverseIntensity) { xControl = (int) xStaticStart; controlPt.setLocation(xEnd, yEnd); startPt.setLocation(xEnd, yStart); endPt.setLocation(xStart, yEnd); } else { xControl = (int) xStaticEnd; controlPt.setLocation(xEnd, yStart); startPt.setLocation(xStart, yStart); endPt.setLocation(xEnd, yEnd); } manager.setMaxEndX(xControl); repaintCurve(); } | void setDefaultExponential(int inputStart, int inputEnd) { setCurrentInputs(inputStart, inputEnd); int k = (int) (curveCoefficient*10); binMin = ((square-40)/(2*rangeMinExpo)); binMax = ((square-40)/(2*rangeMaxExpo)); double yStart, yEnd, xStart, xEnd, xStaticStart, xStaticEnd; xStaticStart = 0; xStaticEnd = 0; yStart = setOuputGraphics(cdStart); yEnd = setOuputGraphics(cdEnd); //output knob setKnobOutputStart(leftBorder-10,(int) yStart); //setKnobOutputEnd(leftBorder-10, topBorder); setKnobOutputEnd(lS+10, topBorder); manager.setOutputRectangles((int) yStart, (int) yEnd); if (k == INIT) { if (reverseIntensity) { xStaticStart = lS2; xStaticEnd = leftBorder; range = (int) xStaticStart-leftBorder; } else { xStaticStart = leftBorder; xStaticEnd = lS2; range = (int) xStaticEnd-leftBorder; } } else if (MIN <= k && k < INIT) { k = INIT-k; if (reverseIntensity) { xStaticEnd = leftBorder; xStaticStart = (lS2+k*binMax); range = (int) xStaticStart-leftBorder; } else { xStaticEnd = (lS2+k*binMax); xStaticStart = leftBorder; range = (int) xStaticEnd-leftBorder; } } else if (k > INIT && k <= MAX) { k = k-INIT; if (reverseIntensity) { xStaticStart = (lS-k*binMin); xStaticEnd = leftBorder; if (xStaticStart < leftBorder+20) xStaticStart = leftBorder+20; range = (int) xStaticStart-leftBorder; } else { xStaticEnd = (lS-k*binMin); xStaticStart = leftBorder; if (xStaticEnd < leftBorder+20) xStaticEnd = leftBorder+20; range = (int) xStaticEnd-leftBorder; } } staticStartPt.setLocation(xStaticStart, yStart); staticEndPt.setLocation(xStaticEnd, yEnd); xStart = setInputGraphics(inputStart, range); xEnd = setInputGraphics(inputEnd, range); setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); if (reverseIntensity) { xControl = (int) xStaticStart; controlPt.setLocation(xEnd, yEnd); startPt.setLocation(xEnd, yStart); endPt.setLocation(xStart, yEnd); } else { xControl = (int) xStaticEnd; controlPt.setLocation(xEnd, yStart); startPt.setLocation(xStart, yStart); endPt.setLocation(xEnd, yEnd); } manager.setMaxEndX(xControl); repaintCurve(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ setCurrentInputs(inputStart, inputEnd); xControl = lS; range = square; binMin = (square/rangeMin); binMax = (square/rangeMax); double yStart, yEnd, xStart, xEnd; yStart = setOuputGraphics(cdStart); yEnd = setOuputGraphics(cdEnd); xStart = setInputGraphics(inputStart, square); xEnd = setInputGraphics(inputEnd, square); setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); setKnobOutputStart(leftBorder-10, (int) yStart); | { setCurrentInputs(inputStart, inputEnd); xControl = lS; range = square; binMin = (square/rangeMin); binMax = (square/rangeMax); double yStart, yEnd, xStart, xEnd; yStart = setOuputGraphics(cdStart); yEnd = setOuputGraphics(cdEnd); xStart = setInputGraphics(inputStart, square); xEnd = setInputGraphics(inputEnd, square); setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); setKnobOutputStart(leftBorder-10, (int) yStart); | void setDefaultLinear(int inputStart, int inputEnd) { setCurrentInputs(inputStart, inputEnd); xControl = lS; range = square; binMin = (square/rangeMin); binMax = (square/rangeMax); double yStart, yEnd, xStart, xEnd; yStart = setOuputGraphics(cdStart); yEnd = setOuputGraphics(cdEnd); xStart = setInputGraphics(inputStart, square); xEnd = setInputGraphics(inputEnd, square); //Size the rectangles used to control knobs. //Input knob. setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); //Output knob. setKnobOutputStart(leftBorder-10, (int) yStart); //setKnobOutputEnd(leftBorder-10, topBorder); setKnobOutputEnd(lS+10, topBorder); manager.setOutputRectangles((int) yStart, (int) yEnd); //Control points location. if (reverseIntensity) { staticStartPt.setLocation(lS, yStart); staticEndPt.setLocation(leftBorder, yEnd); startPt.setLocation(xEnd, yStart); endPt.setLocation(xStart, yEnd); } else { staticStartPt.setLocation(leftBorder, yStart); startPt.setLocation(xStart, yStart); staticEndPt.setLocation(lS, yEnd); endPt.setLocation(xEnd, yEnd); } //draw curve int k; if (family == QuantumFactory.LINEAR) k = INIT; else if (family == QuantumFactory.LOGARITHMIC) k = MIN; else k = (int) (curveCoefficient*10); setControlLocation(k); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
manager.setOutputRectangles((int) yStart, (int) yEnd); if (reverseIntensity) { staticStartPt.setLocation(lS, yStart); staticEndPt.setLocation(leftBorder, yEnd); startPt.setLocation(xEnd, yStart); endPt.setLocation(xStart, yEnd); } else { staticStartPt.setLocation(leftBorder, yStart); startPt.setLocation(xStart, yStart); staticEndPt.setLocation(lS, yEnd); endPt.setLocation(xEnd, yEnd); } int k; if (family == QuantumFactory.LINEAR) k = INIT; else if (family == QuantumFactory.LOGARITHMIC) k = MIN; else k = (int) (curveCoefficient*10); setControlLocation(k); } | manager.setOutputRectangles((int) yStart, (int) yEnd); if (reverseIntensity) { staticStartPt.setLocation(lS, yStart); staticEndPt.setLocation(leftBorder, yEnd); startPt.setLocation(xEnd, yStart); endPt.setLocation(xStart, yEnd); } else { staticStartPt.setLocation(leftBorder, yStart); startPt.setLocation(xStart, yStart); staticEndPt.setLocation(lS, yEnd); endPt.setLocation(xEnd, yEnd); } int k; if (family == QuantumFactory.LINEAR) k = INIT; else if (family == QuantumFactory.LOGARITHMIC) k = MIN; else k = (int) (curveCoefficient*10); setControlLocation(k); } | void setDefaultLinear(int inputStart, int inputEnd) { setCurrentInputs(inputStart, inputEnd); xControl = lS; range = square; binMin = (square/rangeMin); binMax = (square/rangeMax); double yStart, yEnd, xStart, xEnd; yStart = setOuputGraphics(cdStart); yEnd = setOuputGraphics(cdEnd); xStart = setInputGraphics(inputStart, square); xEnd = setInputGraphics(inputEnd, square); //Size the rectangles used to control knobs. //Input knob. setKnobStart((int) xStart); setKnobEnd((int) xEnd); manager.setInputRectangles((int) xStart, (int) xEnd); //Output knob. setKnobOutputStart(leftBorder-10, (int) yStart); //setKnobOutputEnd(leftBorder-10, topBorder); setKnobOutputEnd(lS+10, topBorder); manager.setOutputRectangles((int) yStart, (int) yEnd); //Control points location. if (reverseIntensity) { staticStartPt.setLocation(lS, yStart); staticEndPt.setLocation(leftBorder, yEnd); startPt.setLocation(xEnd, yStart); endPt.setLocation(xStart, yEnd); } else { staticStartPt.setLocation(leftBorder, yStart); startPt.setLocation(xStart, yStart); staticEndPt.setLocation(lS, yEnd); endPt.setLocation(xEnd, yEnd); } //draw curve int k; if (family == QuantumFactory.LINEAR) k = INIT; else if (family == QuantumFactory.LOGARITHMIC) k = MIN; else k = (int) (curveCoefficient*10); setControlLocation(k); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ double b = (double) r/(maximum-minimum); return (b*(x-minimum)+leftBorder); } | { double b = (double) r/(maximum-minimum); return (b*(x-minimum)+leftBorder); } | private double setInputGraphics(int x, int r) { double b = (double) r/(maximum-minimum); return (b*(x-minimum)+leftBorder); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ start = ""+s; end = ""+e; } | { start = ""+s; end = ""+e; } | private void setInputWindow(int s, int e) { start = ""+s; end = ""+e; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
int xRealEnd) { setInputWindow(min, max); setCurrentInputs(xRealStart, xRealEnd); minimum = min; maximum = max; updateInputStartAndEnd(xStart, xEnd); } | int xRealEnd) { setInputWindow(min, max); setCurrentInputs(xRealStart, xRealEnd); minimum = min; maximum = max; updateInputStartAndEnd(xStart, xEnd); } | void setInputs(int min, int max, int xStart, int xEnd, int xRealStart, int xRealEnd) { setInputWindow(min, max); setCurrentInputs(xRealStart, xRealEnd); minimum = min; maximum = max; updateInputStartAndEnd(xStart, xEnd); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ xEnd1 = x; xEnd2 = x-triangleW; xEnd3 = x+triangleW; } | { xEnd1 = x; xEnd2 = x-triangleW; xEnd3 = x+triangleW; } | private void setKnobEnd(int x) { xEnd1 = x; xEnd2 = x-triangleW; xEnd3 = x+triangleW; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ xEndOutput1 = x; xEndOutput2 = x+triangleH; xEndOutput3 = x+triangleH; yEndOutput1 = y; yEndOutput2 = y-triangleW; yEndOutput3 = y+triangleW; } | { xEndOutput1 = x; xEndOutput2 = x+triangleH; xEndOutput3 = x+triangleH; yEndOutput1 = y; yEndOutput2 = y-triangleW; yEndOutput3 = y+triangleW; } | private void setKnobOutputEnd(int x, int y) { xEndOutput1 = x; xEndOutput2 = x+triangleH; xEndOutput3 = x+triangleH; yEndOutput1 = y; yEndOutput2 = y-triangleW; yEndOutput3 = y+triangleW; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ xStartOutput1 = x; xStartOutput2 = x-triangleH; xStartOutput3 = x-triangleH; yStartOutput1 = y; yStartOutput2 = y-triangleW; yStartOutput3 = y+triangleW; } | { xStartOutput1 = x; xStartOutput2 = x-triangleH; xStartOutput3 = x-triangleH; yStartOutput1 = y; yStartOutput2 = y-triangleW; yStartOutput3 = y+triangleW; } | private void setKnobOutputStart(int x, int y) { xStartOutput1 = x; xStartOutput2 = x-triangleH; xStartOutput3 = x-triangleH; yStartOutput1 = y; yStartOutput2 = y-triangleW; yStartOutput3 = y+triangleW; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ xStart1 = x; xStart2 = x-triangleW; xStart3 = x+triangleW; } | { xStart1 = x; xStart2 = x-triangleW; xStart3 = x+triangleW; } | private void setKnobStart(int x) { xStart1 = x; xStart2 = x-triangleW; xStart3 = x+triangleW; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ yStart1 = y; yStart2 = y+triangleH; yStart3 = y+triangleH; } | { yStart1 = y; yStart2 = y+triangleH; yStart3 = y+triangleH; } | private void setKnobStartY(int y) { yStart1 = y; yStart2 = y+triangleH; yStart3 = y+triangleH; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ double a = (double) square/outputRange; return (tS-x*a); } | { double a = (double) square/outputRange; return (tS-x*a); } | private double setOuputGraphics(int x) { double a = (double) square/outputRange; return (tS-x*a); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ this.reverseIntensity = reverseIntensity; } | { this.reverseIntensity = reverseIntensity; } | void setReverseIntensity(boolean reverseIntensity) { this.reverseIntensity = reverseIntensity; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ curEnd = "end: "+xReal; /* limit control b/c the method can be called via the histogram Dialog widget */ boolean b = true; /* control to synchronize the display of real value using the Histogram widget the user can still size the inputWindow but for graphics reasons the cursor in the curvePanel cannot be repainted (cf. limit control below.). */ int limit; if (reverseIntensity) limit = (int) endPt.getX()-triangleW; else limit = (int) startPt.getX()+triangleW; if (x >= limit) { setKnobEnd(x); b = false; if (reverseIntensity) startPt.setLocation(x, startPt.getY()); else endPt.setLocation(x, endPt.getY()); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(x, endPt.getY()); else controlPt.setLocation(x, startPt.getY()); repaintCurve(); } else setControlLocation(coefficient); } if (b) repaint(0, tS+bottomBorder, width, bottomBorderSupp); } | { curEnd = "end: "+xReal; /* limit control b/c the method can be called via the histogram Dialog widget */ boolean b = true; /* control to synchronize the display of real value using the Histogram widget the user can still size the inputWindow but for graphics reasons the cursor in the curvePanel cannot be repainted (cf. limit control below.). */ int limit; if (reverseIntensity) limit = (int) endPt.getX()-triangleW; else limit = (int) startPt.getX()+triangleW; if (x >= limit) { setKnobEnd(x); b = false; if (reverseIntensity) startPt.setLocation(x, startPt.getY()); else endPt.setLocation(x, endPt.getY()); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(x, endPt.getY()); else controlPt.setLocation(x, startPt.getY()); repaintCurve(); } else setControlLocation(coefficient); } if (b) repaint(0, tS+bottomBorder, width, bottomBorderSupp); } | void updateInputEnd(int x, int xReal) { curEnd = "end: "+xReal; /* limit control b/c the method can be called via the histogram Dialog widget */ boolean b = true; /* control to synchronize the display of real value using the Histogram widget the user can still size the inputWindow but for graphics reasons the cursor in the curvePanel cannot be repainted (cf. limit control below.). */ int limit; if (reverseIntensity) limit = (int) endPt.getX()-triangleW; else limit = (int) startPt.getX()+triangleW; if (x >= limit) { setKnobEnd(x); b = false; if (reverseIntensity) startPt.setLocation(x, startPt.getY()); else endPt.setLocation(x, endPt.getY()); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(x, endPt.getY()); else controlPt.setLocation(x, startPt.getY()); repaintCurve(); } else setControlLocation(coefficient); } if (b) repaint(0, tS+bottomBorder, width, bottomBorderSupp); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ curStart = "start: "+xReal; /* limit control b/c the method can be called via the histogram Dialog widget */ boolean b = true; /* control to synchronize the display of real value using the Histogram widget the user can still size the inputWindow but for graphics reasons the cursor in the curvePanel cannot be repainted (cf. limit control below.). */ int limit; if (reverseIntensity) limit = (int) startPt.getX()-triangleW; else limit = (int) endPt.getX()-triangleW; if (x <= limit) { xStartMax = x; b = false; setKnobStart(x); if (reverseIntensity) endPt.setLocation(x, endPt.getY()); else startPt.setLocation(x, startPt.getY()); if (type == QuantumFactory.EXPONENTIAL) repaintCurve(); else setControlLocation(coefficient); } if (b) repaint(0, tS+bottomBorder, width, bottomBorderSupp); } | { curStart = "start: "+xReal; /* limit control b/c the method can be called via the histogram Dialog widget */ boolean b = true; /* control to synchronize the display of real value using the Histogram widget the user can still size the inputWindow but for graphics reasons the cursor in the curvePanel cannot be repainted (cf. limit control below.). */ int limit; if (reverseIntensity) limit = (int) startPt.getX()-triangleW; else limit = (int) endPt.getX()-triangleW; if (x <= limit) { xStartMax = x; b = false; setKnobStart(x); if (reverseIntensity) endPt.setLocation(x, endPt.getY()); else startPt.setLocation(x, startPt.getY()); if (type == QuantumFactory.EXPONENTIAL) repaintCurve(); else setControlLocation(coefficient); } if (b) repaint(0, tS+bottomBorder, width, bottomBorderSupp); } | void updateInputStart(int x, int xReal) { curStart = "start: "+xReal; /* limit control b/c the method can be called via the histogram Dialog widget */ boolean b = true; /* control to synchronize the display of real value using the Histogram widget the user can still size the inputWindow but for graphics reasons the cursor in the curvePanel cannot be repainted (cf. limit control below.). */ int limit; if (reverseIntensity) limit = (int) startPt.getX()-triangleW; else limit = (int) endPt.getX()-triangleW; if (x <= limit) { xStartMax = x; b = false; setKnobStart(x); if (reverseIntensity) endPt.setLocation(x, endPt.getY()); else startPt.setLocation(x, startPt.getY()); if (type == QuantumFactory.EXPONENTIAL) repaintCurve(); else setControlLocation(coefficient); } if (b) repaint(0, tS+bottomBorder, width, bottomBorderSupp); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ xStartMax = xStart; setKnobEnd(xEnd); setKnobStart(xStart); if (reverseIntensity) { endPt.setLocation(xStart, endPt.getY()); startPt.setLocation(xEnd, startPt.getY()); } else { startPt.setLocation(xStart, startPt.getY()); endPt.setLocation(xEnd, endPt.getY()); } if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(xEnd, endPt.getY()); else controlPt.setLocation(xEnd, startPt.getY()); repaintCurve(); } else setControlLocation(coefficient); } | { xStartMax = xStart; setKnobEnd(xEnd); setKnobStart(xStart); if (reverseIntensity) { endPt.setLocation(xStart, endPt.getY()); startPt.setLocation(xEnd, startPt.getY()); } else { startPt.setLocation(xStart, startPt.getY()); endPt.setLocation(xEnd, endPt.getY()); } if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(xEnd, endPt.getY()); else controlPt.setLocation(xEnd, startPt.getY()); repaintCurve(); } else setControlLocation(coefficient); } | private void updateInputStartAndEnd(int xStart, int xEnd) { xStartMax = xStart; setKnobEnd(xEnd); setKnobStart(xStart); if (reverseIntensity) { endPt.setLocation(xStart, endPt.getY()); startPt.setLocation(xEnd, startPt.getY()); } else { startPt.setLocation(xStart, startPt.getY()); endPt.setLocation(xEnd, endPt.getY()); } if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(xEnd, endPt.getY()); else controlPt.setLocation(xEnd, startPt.getY()); repaintCurve(); } else setControlLocation(coefficient); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ setKnobOutputEnd(y); endPt.setLocation(endPt.getX(), y); staticEndPt.setLocation(staticEndPt.getX(), y); setControlLocation(coefficient); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(startPt.getX(), y); else controlPt.setLocation(endPt.getX(), controlPt.getY()); repaintCurve(); } else setControlLocation(coefficient); } | { setKnobOutputEnd(y); endPt.setLocation(endPt.getX(), y); staticEndPt.setLocation(staticEndPt.getX(), y); setControlLocation(coefficient); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(startPt.getX(), y); else controlPt.setLocation(endPt.getX(), controlPt.getY()); repaintCurve(); } else setControlLocation(coefficient); } | void updateOutputEnd(int y) { //controlOutputEnd = y-topBorder; setKnobOutputEnd(y); endPt.setLocation(endPt.getX(), y); staticEndPt.setLocation(staticEndPt.getX(), y); setControlLocation(coefficient); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(startPt.getX(), y); else controlPt.setLocation(endPt.getX(), controlPt.getY()); repaintCurve(); } else setControlLocation(coefficient); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
{ setKnobOutputStart(y); startPt.setLocation(startPt.getX(), y); staticStartPt.setLocation(staticStartPt.getX(), y); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(controlPt.getX(), endPt.getY()); else controlPt.setLocation(controlPt.getX(), y); repaintCurve(); } else setControlLocation(coefficient); } | { setKnobOutputStart(y); startPt.setLocation(startPt.getX(), y); staticStartPt.setLocation(staticStartPt.getX(), y); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(controlPt.getX(), endPt.getY()); else controlPt.setLocation(controlPt.getX(), y); repaintCurve(); } else setControlLocation(coefficient); } | void updateOutputStart(int y) { //controlOutputStart = y-topBorder; setKnobOutputStart(y); startPt.setLocation(startPt.getX(), y); staticStartPt.setLocation(staticStartPt.getX(), y); if (type == QuantumFactory.EXPONENTIAL) { if (reverseIntensity) controlPt.setLocation(controlPt.getX(), endPt.getY()); else controlPt.setLocation(controlPt.getX(), y); repaintCurve(); } else setControlLocation(coefficient); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentation.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentation.java |
QuantumPaneManager control, int type) { this.view = view; this.control = control; this.type = type; boxStart = new Rectangle(); boxEnd = new Rectangle(); boxOutputStart = new Rectangle(); boxOutputEnd = new Rectangle(); maxEndX = leftBorder+square/2; attachListeners(); inputStartKnob = false; inputEndKnob = false; outputStartKnob = false; outputEndKnob = false; } | QuantumPaneManager control, int type) { this.view = view; this.control = control; this.type = type; boxStart = new Rectangle(); boxEnd = new Rectangle(); boxOutputStart = new Rectangle(); boxOutputEnd = new Rectangle(); maxEndX = leftBorder+square/2; attachListeners(); inputStartKnob = false; inputEndKnob = false; outputStartKnob = false; outputEndKnob = false; } | GraphicsRepresentationManager(GraphicsRepresentation view, QuantumPaneManager control, int type) { this.view = view; this.control = control; this.type = type; boxStart = new Rectangle(); boxEnd = new Rectangle(); boxOutputStart = new Rectangle(); boxOutputEnd = new Rectangle(); maxEndX = leftBorder+square/2; //only used if type = exponential attachListeners(); inputStartKnob = false; inputEndKnob = false; outputStartKnob = false; outputEndKnob = false; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentationManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentationManager.java |
{ setOutputStartBox(start); setOutputEndBox(end); } | { setOutputStartBox(start); setOutputEndBox(end); } | void setOutputRectangles(int start, int end) { setOutputStartBox(start); setOutputEndBox(end); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentationManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentationManager.java |
{ | { | void setInputEndBox(int x) { //minEndX = x-2*triangleW; //boxEnd.setBounds(x-2*triangleW, tS+triangleW+1, 4*length, // bottomBorder+bottomBorderSupp); minEndX = x-extraControl; boxEnd.setBounds(x-2*triangleW, 0, 4*length, topBorder); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentationManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentationManager.java |
} | } | void setInputEndBox(int x) { //minEndX = x-2*triangleW; //boxEnd.setBounds(x-2*triangleW, tS+triangleW+1, 4*length, // bottomBorder+bottomBorderSupp); minEndX = x-extraControl; boxEnd.setBounds(x-2*triangleW, 0, 4*length, topBorder); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentationManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentationManager.java |
{ this.type = type; maxEndX = x; } | { this.type = type; maxEndX = x; } | void setType(int type, int x) { this.type = type; maxEndX = x; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentationManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentationManager.java |
{ setInputStartBox(start); setInputEndBox(end); } | { setInputStartBox(start); setInputEndBox(end); } | void setInputRectangles(int start, int end) { setInputStartBox(start); setInputEndBox(end); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1722ebf9ac60fc8e45cdc8d0049e85db5b86715c/GraphicsRepresentationManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/pane/GraphicsRepresentationManager.java |
RubyString rs = RubyString.m_newString(ruby, iString2Eval); | protected static void runInterpreter(String iString2Eval, String iFileName) { // Initialize Runtime Ruby ruby = new Ruby(); // Initialize Parser parse p = new parse(ruby); // Parse and interpret file RubyString rs = RubyString.m_newString(ruby, iString2Eval); ruby.getInterpreter().eval(ruby.getClasses().getObjectClass(), p.rb_compile_string(iFileName, rs, 0)); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a2024bddc1b8e83f4e8075d2080935c221a833fe/Main.java/buggy/org/jruby/Main.java |
|
g.getChildren().add(WFUtil.getTextVB(ref + "versionId")); | g.getChildren().add(WFUtil.getTextVB(ref + "versionName")); | private UIComponent getDetailPanel() { WFResourceUtil localizer = WFResourceUtil.getResourceUtilArticle(); HtmlPanelGrid dp = WFPanelUtil.getPlainFormPanel(1); WFComponentSelector cs = new WFComponentSelector(); cs.setId(COMPONENT_SELECTOR_ID); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(1); p.setId(NO_ARTICLE_ID); p.getChildren().add(localizer.getHeaderTextVB("no_article_selected")); cs.add(p); p = WFPanelUtil.getPlainFormPanel(1); p.setId(ARTICLE_LIST_ID); p.getChildren().add(WFUtil.getHeaderTextVB(ref + "headline")); p.getChildren().add(WFUtil.getText(" ")); p.getChildren().add(WFUtil.getTextVB(ref + "teaser")); p.getChildren().add(WFUtil.getText(" ")); WFPlainOutputText bodyText = new WFPlainOutputText(); WFUtil.setValueBinding(bodyText, "value", ref + "body"); p.getChildren().add(bodyText); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(new WFPlainOutputText("<hr/>")); UIComponent g = WFUtil.group(localizer.getHeaderTextVB("author"), WFUtil.getHeaderText(": ")); g.getChildren().add(WFUtil.getTextVB(ref + "author")); p.getChildren().add(g); p.getChildren().add(WFUtil.getText(" ")); g = WFUtil.group(localizer.getHeaderTextVB("created"), WFUtil.getHeaderText(": ")); g.getChildren().add(WFUtil.getTextVB(ref + "creationDate")); p.getChildren().add(g); p.getChildren().add(WFUtil.getText(" ")); g = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getHeaderText(": ")); g.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(g); p.getChildren().add(WFUtil.getText(" ")); HtmlOutputText t = WFUtil.getTextVB(ref + "categoryNames"); t.setConverter(new WFCommaSeparatedListConverter()); g = WFUtil.group(localizer.getHeaderTextVB("categories"), WFUtil.getHeaderText(": ")); g.getChildren().add(t); p.getChildren().add(g); p.getChildren().add(WFUtil.getText(" ")); g = WFUtil.group(localizer.getHeaderTextVB("current_version"), WFUtil.getHeaderText(": ")); g.getChildren().add(WFUtil.getTextVB(ref + "versionId")); p.getChildren().add(g); p.getChildren().add(WFUtil.getText(" ")); g = WFUtil.group(localizer.getHeaderTextVB("comment"), WFUtil.getHeaderText(": ")); g.getChildren().add(WFUtil.getTextVB(ref + "comment")); p.getChildren().add(g); p.getChildren().add(WFUtil.getText(" ")); g = WFUtil.group(localizer.getHeaderTextVB("source"), WFUtil.getHeaderText(": ")); g.getChildren().add(WFUtil.getTextVB(ref + "source")); p.getChildren().add(g); p.getChildren().add(WFUtil.getText(" ")); WebDAVFileDetails details = new WebDAVFileDetails(); WFUtil.setValueBinding(details,"currentResourcePath",ref+"resourcePath"); p.getChildren().add(details); cs.add(p); cs.setSelectedId(NO_ARTICLE_ID, true); dp.getChildren().add(cs); return dp; } | 57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/a297f9c775743ee62319cf6d212fccea6bc19345/ArticleDetailView.java/clean/src/java/com/idega/block/article/component/ArticleDetailView.java |
fixnumClass.defineMethod("taint", CallbackFactory.getSelfMethod()); fixnumClass.defineMethod("freeze", CallbackFactory.getSelfMethod()); | fixnumClass.defineMethod("taint", CallbackFactory.getSelfMethod(0)); fixnumClass.defineMethod("freeze", CallbackFactory.getSelfMethod(0)); | public static RubyClass createFixnumClass(Ruby ruby) { RubyClass fixnumClass = ruby.defineClass("Fixnum", ruby.getClasses().getIntegerClass()); fixnumClass.includeModule(ruby.getClasses().getPrecisionModule()); fixnumClass.defineSingletonMethod("induced_from", CallbackFactory.getSingletonMethod(RubyFixnum.class, "induced_from", RubyObject.class)); fixnumClass.defineMethod("to_f", CallbackFactory.getMethod(RubyFixnum.class, "to_f")); fixnumClass.defineMethod("to_s", CallbackFactory.getMethod(RubyFixnum.class, "to_s")); fixnumClass.defineMethod("to_str", CallbackFactory.getMethod(RubyFixnum.class, "to_s")); fixnumClass.defineMethod("hash", CallbackFactory.getMethod(RubyFixnum.class, "hash")); fixnumClass.defineMethod("taint", CallbackFactory.getSelfMethod()); fixnumClass.defineMethod("freeze", CallbackFactory.getSelfMethod()); fixnumClass.defineMethod("<<", CallbackFactory.getMethod(RubyFixnum.class, "op_lshift", RubyObject.class)); fixnumClass.defineMethod(">>", CallbackFactory.getMethod(RubyFixnum.class, "op_rshift", RubyObject.class)); fixnumClass.defineMethod("+", CallbackFactory.getMethod(RubyFixnum.class, "op_plus", RubyObject.class)); fixnumClass.defineMethod("-", CallbackFactory.getMethod(RubyFixnum.class, "op_minus", RubyObject.class)); fixnumClass.defineMethod("*", CallbackFactory.getMethod(RubyFixnum.class, "op_mul", RubyObject.class)); fixnumClass.defineMethod("/", CallbackFactory.getMethod(RubyFixnum.class, "op_div", RubyObject.class)); fixnumClass.defineMethod("%", CallbackFactory.getMethod(RubyFixnum.class, "op_mod", RubyObject.class)); fixnumClass.defineMethod("**", CallbackFactory.getMethod(RubyFixnum.class, "op_pow", RubyObject.class)); fixnumClass.defineMethod("==", CallbackFactory.getMethod(RubyFixnum.class, "op_equal", RubyObject.class)); fixnumClass.defineMethod("<=>", CallbackFactory.getMethod(RubyFixnum.class, "op_cmp", RubyObject.class)); fixnumClass.defineMethod(">", CallbackFactory.getMethod(RubyFixnum.class, "op_gt", RubyObject.class)); fixnumClass.defineMethod(">=", CallbackFactory.getMethod(RubyFixnum.class, "op_ge", RubyObject.class)); fixnumClass.defineMethod("<", CallbackFactory.getMethod(RubyFixnum.class, "op_lt", RubyObject.class)); fixnumClass.defineMethod("<=", CallbackFactory.getMethod(RubyFixnum.class, "op_le", RubyObject.class)); fixnumClass.defineMethod("&", CallbackFactory.getMethod(RubyFixnum.class, "op_and", RubyObject.class)); fixnumClass.defineMethod("|", CallbackFactory.getMethod(RubyFixnum.class, "op_or", RubyInteger.class)); fixnumClass.defineMethod("^", CallbackFactory.getMethod(RubyFixnum.class, "op_xor", RubyInteger.class)); fixnumClass.defineMethod("size", CallbackFactory.getMethod(RubyFixnum.class, "size")); fixnumClass.defineMethod("[]", CallbackFactory.getMethod(RubyFixnum.class, "aref", RubyInteger.class)); return fixnumClass; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/6076c5ab87d25a488469aa1a32f1d2c9c9e470b2/RubyFixnum.java/clean/org/jruby/RubyFixnum.java |
value = value.getInstanceVariable("java_object"); | value = value.getInstanceVariable("@java_object"); | public IRubyObject setValue(IRubyObject value) { runtime.getLoadService().require("java"); if (value.isKindOf(runtime.getModule("JavaProxy"))) { value = value.getInstanceVariable("java_object"); } value = Java.primitive_to_java(value, value); bean.bean = JavaUtil.convertArgument(value, bean.type); return value; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/05818f60469bc6a8de593f8e77b24c7405fd52ee/JRubyEngine.java/buggy/src/org/jruby/javasupport/bsf/JRubyEngine.java |
public FileTemplate(Broker broker, File templateFile) { super(broker); myFile = templateFile; | public FileTemplate(Broker broker, String filename) { this (broker, new File(filename), defaultEncoding(broker)); | public FileTemplate(Broker broker, File templateFile) { super(broker); myFile = templateFile; } | 52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/88d36323ffe7fe0fb49ed32b696ba5e32dca3489/FileTemplate.java/buggy/webmacro/src/org/webmacro/engine/FileTemplate.java |
int index = -1; | public void actionPerformed(ActionEvent e) { int index = -1; try { index = Integer.parseInt(e.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(startTField, endTField); break; case END_T: movieEndActionHandler(startTField, endTField); break; case START_Z: movieStartActionHandler(startZField, endZField); break; case END_Z: movieEndActionHandler(startZField, endZField); break; case Player.MOVIE_T: case Player.MOVIE_Z: handleIndexChanged(index); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+index, nfe); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ba2070eeb46c459cbb8ad43439d3f9ab12cf63e3/MoviePaneMng.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/movie/pane/MoviePaneMng.java |
|
index = Integer.parseInt(e.getActionCommand()); | int index = Integer.parseInt(e.getActionCommand()); | public void actionPerformed(ActionEvent e) { int index = -1; try { index = Integer.parseInt(e.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(startTField, endTField); break; case END_T: movieEndActionHandler(startTField, endTField); break; case START_Z: movieStartActionHandler(startZField, endZField); break; case END_Z: movieEndActionHandler(startZField, endZField); break; case Player.MOVIE_T: case Player.MOVIE_Z: handleIndexChanged(index); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+index, nfe); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ba2070eeb46c459cbb8ad43439d3f9ab12cf63e3/MoviePaneMng.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/movie/pane/MoviePaneMng.java |
throw new Error("Invalid Action ID "+index, nfe); | throw new Error("Invalid Action ID "+e.getActionCommand(), nfe); | public void actionPerformed(ActionEvent e) { int index = -1; try { index = Integer.parseInt(e.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(startTField, endTField); break; case END_T: movieEndActionHandler(startTField, endTField); break; case START_Z: movieStartActionHandler(startZField, endZField); break; case END_Z: movieEndActionHandler(startZField, endZField); break; case Player.MOVIE_T: case Player.MOVIE_Z: handleIndexChanged(index); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+index, nfe); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ba2070eeb46c459cbb8ad43439d3f9ab12cf63e3/MoviePaneMng.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/movie/pane/MoviePaneMng.java |
startTField = view.getMovieStartT(); endTField = view.getMovieEndT(); startZField = view.getMovieStartZ(); endZField = view.getMovieEndZ(); | startTField = view.movieStartT; endTField = view.movieEndT; startZField = view.movieStartZ; endZField = view.movieEndZ; | void attachListeners() { //TexField startTField = view.getMovieStartT(); endTField = view.getMovieEndT(); startZField = view.getMovieStartZ(); endZField = view.getMovieEndZ(); attachFieldListeners(startTField, START_T); attachFieldListeners(endTField, END_T); attachFieldListeners(startZField, START_Z); attachFieldListeners(endZField, END_Z); //RadioButton attachButtonListener(view.getMovieZ(), Player.MOVIE_Z); attachButtonListener(view.getMovieT(), Player.MOVIE_T); view.getSliderT().addChangeListener(this); view.getSliderZ().addChangeListener(this); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ba2070eeb46c459cbb8ad43439d3f9ab12cf63e3/MoviePaneMng.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/movie/pane/MoviePaneMng.java |
attachButtonListener(view.getMovieZ(), Player.MOVIE_Z); attachButtonListener(view.getMovieT(), Player.MOVIE_T); view.getSliderT().addChangeListener(this); view.getSliderZ().addChangeListener(this); | attachButtonListener(view.movieZ, Player.MOVIE_Z); attachButtonListener(view.movieT, Player.MOVIE_T); view.sliderT.addChangeListener(this); view.sliderZ.addChangeListener(this); | void attachListeners() { //TexField startTField = view.getMovieStartT(); endTField = view.getMovieEndT(); startZField = view.getMovieStartZ(); endZField = view.getMovieEndZ(); attachFieldListeners(startTField, START_T); attachFieldListeners(endTField, END_T); attachFieldListeners(startZField, START_Z); attachFieldListeners(endZField, END_Z); //RadioButton attachButtonListener(view.getMovieZ(), Player.MOVIE_Z); attachButtonListener(view.getMovieT(), Player.MOVIE_T); view.getSliderT().addChangeListener(this); view.getSliderZ().addChangeListener(this); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ba2070eeb46c459cbb8ad43439d3f9ab12cf63e3/MoviePaneMng.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/movie/pane/MoviePaneMng.java |
view.getMovieZ().setSelected(true); | view.movieZ.setSelected(true); | private void handleIndexChanged(int index) { if (maxT == 0) { view.getMovieZ().setSelected(true); UserNotifier un = registry.getUserNotifier(); un.notifyInfo("Invalid selection", "The selected image has only one timepoint. "); } if (maxZ == 0) { view.getMovieT().setSelected(true); UserNotifier un = registry.getUserNotifier(); un.notifyInfo("Invalid selection", "The selected image has only one z-section. "); } if (maxZ != 0 && maxT != 0) setMovieIndex(index); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ba2070eeb46c459cbb8ad43439d3f9ab12cf63e3/MoviePaneMng.java/clean/SRC/org/openmicroscopy/shoola/agents/viewer/movie/pane/MoviePaneMng.java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.