text
stringlengths
14
410k
label
int32
0
9
@Override public void run() { progressBar.setMaximum(gen.getTotal().intValue()); //length is the number of permutations starting with Albany, which are always at the beginning int length = (gen.getTotal().intValue())/numCities; int progress = 0; double shortestDistance = Double.POSITIVE_INFINITY; ...
9
private void durchlaufe(int pStartknoten, int[] pBesucht) { if (pBesucht[pStartknoten] != 1) { System.out.println(pStartknoten); } pBesucht[pStartknoten] = 1; int[] lNachbar = this.nachbarKnoten(pStartknoten); for (int i = 0; i < lNachbar.length; i++) { if...
3
public void render(GameContainer gc, Graphics gr) throws SlickException { for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Skill) { entityList.get(i).renderSkill(gc, null, gr, ((Skill) entityList.get(i)).isOnCooldown()); if (((Skill) entityList.get(i)).isOnCooldown()) { t...
7
@Override public void deserialize(Buffer buf) { elementId = buf.readInt(); if (elementId < 0) throw new RuntimeException("Forbidden value on elementId = " + elementId + ", it doesn't respect the following condition : elementId < 0"); elementTypeId = buf.readInt(); int lim...
3
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); Vector values = (Vector) s.readObject(); int indexCounter = 0; int maxCounter = values.size(); if (indexCounter < maxCounter && values.elementAt(indexCounter).equals("graphModel")) { grap...
9
public static void doubleHashing() { System.out.println("START OF DOUBLE HASHING"); statsDouble = new ArrayList<Stats>(); List<Integer> sieve = MakeList.makeEratosthenesSieve(); // System.out.println(sieve); for (Integer aSieve : sieve) { for (int j = 0; j < 50; j+...
3
public synchronized void respond(IRCCommand cmd){ if (cmd == null || cmd == IRCCommand.NONE){ return; } if(cmd == IRCCommand.PONG){ String pong = "PONG " + "Dinosaur" + Main.version; output.write(pong + "\r\n"); //output.flush(); System.out.println(pong); } }
3
public void transport(Checker c) { if(this.getY() == 0 && c.team == 2) { c.setLocation(this.getX(), 7); Greenfoot.playSound("tunnel.wav"); } else if(this.getY() == 8 && c.team == 1) { c.setLocation(this.getX(), 1); Greenfoot.playSound("tunnel.wav"); ...
4
public Missile getNearestMissile(){ double nearestDistance = 100000; Missile nearestMissile = null; for(Missile missile : missiles){ if(missile != null){ if(settings.screenWidth - missile.posY < nearestDistance){ nearestDistance = settings.screenWidth - missile.posY; nearestM...
3
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { final String s=CMParms.combine(commands,1).toLowerCase(); try { if(CMath.isInteger(s)) { int h=CMath.s_int(s); if(h==0) h=1; mob.tell(L("..tick..tock..")); mob.location().get...
8
public void setMessages(List<String> messages) { this.messages = messages; }
0
public static void checkFainted() { System.out.print("Checking for fainted Pokemon..."); for(int i=0; i<userNumOfPokemon; i++) if(user[i].health<=0) { user[i].health=0; user[i].status=Pokemon.Status.FNT; } for(int i=0; i<enemyNumOfPokemon; i++) if(enemy[i].health<=0) { enemy[i].healt...
4
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(target==mob) { mob.tell(L("Um, you could just enter SCORE.")); return false; } if(!super...
9
protected void handleEvent(final Message<JsonObject> event) { if (event.body().getString("subscribe") != null) { try { String destination = event.body().getString("subscribe"); System.err.println("SUBSCRIBE: " + destination); Session session = this.con...
7
private IautosStatusCode(int code, String desc) { this.code = code; this.desc = desc; }
0
public static String selectFileExtension(Keyword type) { { String extension = null; { Cons entry = null; Cons iter000 = Stella.$TYPE_TO_FILE_EXTENSION_TABLE$; for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) { entry = ((Cons)(iter000.value)); if (entry.value == typ...
6
public Long getId() { return id; }
0
@Override public Value get(Key key) { for (Node x = first; x != null; x = x.next) { // cmp++; if (key.equals(x.key)) return x.val; } return null; }
2
public static String[] getPhonemeASR(String refWords, String refPhones, String testWav, String lesson) { String[] line = new String[3]; int timeout = 0; int trial = 0; // if (!Globals.installer){ // testWav = "../../" + testWav.replaceAll("\"", ""); // } String j_phcmd = "janus -f janus/phonemes/getUtt...
9
public static void main(String[] args) { Shape[] shapes = new Shape[2]; System.out.println("New SHAPES:"); shapes[0] = new Square(4); shapes[1] = new Triangle(); for (Shape shape : shapes) { System.out.println(shape); shape.draw(); System.out.p...
1
public static void initialize() { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); UIM...
6
public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc; ArrayList<String> list = new ArrayList<String>(); int nbAnag; try{ sc = new Scanner(new File("dictionary.txt")); while(sc.hasNext()) { String str = sc.next(); //System.out.print(str+"\n"); list.add(...
8
private void addParticipant() { lblError.setVisible(false); Anstalld selAnst = (Anstalld) cbSpecialist.getSelectedItem(); DefaultListModel<Anstalld> dlm = (DefaultListModel<Anstalld>) listParticipantsHolder.getModel(); boolean exists = false; // check if the participant is already added ...
5
private void initialize() { bank=new Bank("Accounts.txt"); frmBank = new JFrame(); frmBank.setTitle("Bank"); frmBank.setBounds(100, 100, 457, 325); frmBank.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton btnViewAccounts = new JButton("View All Accounts"); btnViewAccounts.setToolTipText("Opens a...
7
public static void main(String[] args) throws Throwable { System.out.println(System.currentTimeMillis()); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(in.readLine()); for (int tc = 0; tc < n; tc++) { int nn = Inte...
8
public boolean isExecutable() { return ((status == Watchable.PAUSED || status == Watchable.RUNNING) && (gate == null || !gate.stop())); }
3
protected void checkListeningThreads() { final List<ListeningThread> threadsForRemoval = new ArrayList<ListeningThread>(); for (final ListeningThread listeningThread : this.listeningThreads) { threadsForRemoval.add(listeningThread); } for (final InetSocketAddress inetSocketAddress : this.listeningAddresse...
7
public boolean isUsed(Tile t) { for (int y = 0; y < bounds.height; y++) { for (int x = 0; x < bounds.width; x++) { if (map[y][x] == t) { return true; } } } return false; }
3
@SuppressWarnings({ "unchecked", "rawtypes" }) public <T> T deserialze(PBDeserializer parser, Type type, Object fieldName) { Collection array = null; try { if (fieldName != null) { byte tmpIsNull = parser.getTheCodedInputStream().readRawByte(); if (tmpIsNull == 1) { ...
9
@Override public int getSamples(byte[] buffer) { byte[] pwmBuffer = null; if(pulseWidthCvProvider != null) { pwmBuffer = new byte[buffer.length]; pulseWidthCvProvider.getSamples(pwmBuffer); } int index = 0; for (int i = 0; i < (buffer.length / 2); i+...
5
public void display(BufferedImage bi) { Graphics g = null; try { if (bi != null) { g = bs.getDrawGraphics(); g.drawImage(bi, 0, 0, canvas.getWidth(), canvas.getHeight(), null); long ct = System.currentTimeMillis(); long lt = ct - FR_SAMPLE_HISTORY; long t, dt; long maxdt = 0; long min...
9
public void init( Environment<String,BasicType> additionalSettings, Environment<String,BasicType> optionalReturnValues ) throws InstantiationException { synchronized( this ) { // Since version 0.9.9 it is possible to re-use the handler instance ('sharedHandlerInstance' in // the server config)....
4
public void addObject(int var1, Object var2) { Integer var3 = (Integer)dataTypes.get(var2.getClass()); if(var3 == null) { throw new IllegalArgumentException("Unknown data type: " + var2.getClass()); } else if(var1 > 31) { throw new IllegalArgumentException("Data value id is too big w...
3
public void removePush() { if (stackMap == null) /* already done or mapping didn't succeed */ return; stackMap = null; block.removePush(); Iterator iter = successors.keySet().iterator(); while (iter.hasNext()) { FlowBlock succ = (FlowBlock) iter.next(); succ.removePush(); } }
2
static protected int[] case5(int[][] a) { int[] result = new int[2]; int tmp1, tmp2; if (a[3][1] <= a[1][1]) { tmp1 = a[0][0] + a[2][0]; tmp2 = a[1][0] + a[3][0]; } else if (a[3][1] > a[1][1] && a[1][1] + a[0][1] >= a[3][1]) { tmp1 = a[1][0] + a[3][0]; tmp2 = a[2][0] > a[3][0] ? a[2][0] : a[3][0];...
8
private static ArrayList<Integer> getPrimesSieve(int n) { ArrayList<Boolean> integerList = new ArrayList<Boolean>(); ArrayList<Integer> primes = new ArrayList<Integer>(); /* Initialize Arrays: * (1) Mark all other numbers as prime initially * (2) 0, 1 not considered primes */ integerList.add(fal...
6
public static void sendPlayerToHome( BSPlayer player, String home ) { Home h = getSimilarHome( player, home ); if ( h == null ) { player.sendMessage( Messages.HOME_DOES_NOT_EXIST ); return; } Location l = h.loc; ByteArrayOutputStream b = new ByteArrayOutpu...
3
public static IPv4Network getByAddress(String address, int mask) throws NetworkException { if ((mask < 0) || (mask > 32)) { throw new InvalidAddressException(String.format("'%d' is not a valid IPv4 mask.", mask)); } try { return new IPv4Network(new BigInteger(Inet4Address...
3
public static Element getParentElement(Element element) { if (element == null) { return null; } Element parentElement = null; Node parentNode = element.getParentNode(); while (parentNode != null && parentElement == null) { if (parentNode.getNodeType() == Node.ELEMENT_NODE) { parentElement = (Element...
6
public static void display(String tableName){ Statement stmt = null; ResultSet rs = null; String sql; try{ stmt= conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); if(tableName.toLowerCase().equals("patients")){ sql = "SELECT * FROM PATIENTS"; rs = stmt.exec...
9
public String httpPost(String url, String queryString) throws Exception { String responseData = null; HttpClient httpClient = new HttpClient(); PostMethod httpPost = new PostMethod(url); httpPost.addParameter("Content-Type", "application/x-www-form-urlencoded"); httpPost.getParams().setParameter("http.soc...
4
private void process(BruteTreeNode node, int level) { if (this.solutions.size() >= this.getExpectedSolutionCount()) { return; } ValidationResult result = node.validate(); switch(result) { case RESOLVED: this.solutions.add(node); ...
7
public List<Message> getUserMessages(String userEmail) { initConnection(); String preparedString = null; PreparedStatement preparedQuery = null; List<Message> messageList = null; try { //Prepare Statement preparedString = "SELECT * FROM messages " + "INNER JOIN users ON users.email...
3
public void visit_areturn(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
1
private boolean check() { if (N == 0) { if (first != null) return false; } else if (N == 1) { if (first == null) return false; if (first.next != null) return false; } else { if (first.next == null) return false; } ...
8
private boolean isValidSequence(List<Chemin> listeAvalider){ boolean isOk= true; boolean tmpBool= false; List<Chemin> tmpListe = listeAvalider; //QuickSort<Chemin> qSort = new QuickSort<>(tmpListe, 0 , tmpListe.size()); //Collections.sort(tmpListe, new CheminComparator()); for (int i = 0; i < listeAvalide...
5
public boolean equals(Object other) { if ((this == other)) return true; if ((other == null)) return false; if (!(other instanceof UsuarioId)) return false; UsuarioId castOther = (UsuarioId) other; return (this.getId() == castOther.getId()) && ((this.getUser() == castOther.getUser()) || (this.get...
7
public String viewMember(String firstName, String lastName, String concordiaID){ String foundMember; DecimalFormat df = new DecimalFormat("#.##"); for(ConcordiaMembers member: concordiaMembers){ if(member!=null){ if(member.getFirstName().equals(firstName) && member.getLastName().equals(lastName) && me...
5
public DocumentRepository() {}
0
public List<String> getSchedule_indications() { List<String> indications = new LinkedList<String>(); for (Indication schedule_indication : schedule_indications) { if (schedule_indication == null || schedule_indication.getText() == null) continue; indications.add(s...
3
public static boolean stringRotation(String str1, String str2) { if(str1.length() != str2.length()) return false; String two = str1.substring(0, 2); int j, i = 2; if((j = str2.indexOf(two)) != -1) j += 2; else if(str2.charAt(str2.length() - 1) == two.charAt(0) && str2.charAt(0) == two.charAt(1)) j = ...
7
public static void main(String[] args) { String[] rankArray = {"Ace", "Jack"}; String[] SuitArray = {"Spades", "Diamonds", "Fun"}; Integer[] pointArray = {1, 2}; Deck Bicycle = new Deck(rankArray, SuitArray, pointArray); Bicycle.shuffle(); System.out.println(Bicycle.deal()); System.out.println(Bicycle.Dec...
0
public int creationpays(int idpays, String nom, String cp) { retour = 0; try { RequetesVille.insertVille(idpays, nom, cp); } catch (SQLException ex) { if (ex.getErrorCode() == 1062) { //error nom de ville deja dans le fichier retour = 106...
2
public static String ticksToTimeString(long var0) { long var2 = var0 / 20L; long var4 = var2 / 60L; long var6 = var4 / 60L; long var8 = var6 / 24L; String var10 = ""; if (var8 > 0L) { var10 = var8 + ":"; } if (var6 > 0L) {...
8
public void paint(Graphics g, Shape a) { RSyntaxDocument document = (RSyntaxDocument)getDocument(); Rectangle alloc = a.getBounds(); tabBase = alloc.x; host = (RSyntaxTextArea)getContainer(); Rectangle clip = g.getClipBounds(); // An attempt to speed things up for files with long lines. Note that // ...
8
public ParamFrame(String title, String textLabel, int _param, int _count, final boolean isSpline){ super(title); content = getContentPane(); JPanel p = new JPanel(); JLabel paramLabel = new JLabel(textLabel); final JTextField paramField = new JTextField(); paramField.setText(_param+""); JLabel count...
5
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { myPointPanel.togglePointType(); if(myPointPanel.getCurrentType()==PointType.BLUE){ clabel.setText("<html>Color: <font color='blue'>blue</font> - space to change</html>"); } else{ clabel.setText("<html>Color...
8
public void mouseEntered(MouseEvent e) {}
0
public static void blockUntilProcessEnd(Process process, int timeOut) { int maxCount = timeOut * 5; for (int i = 0; i < maxCount && checkProcessEnd(process); i++) { try { Thread.sleep(200); } catch (InterruptedException e) { logger.error(e); ...
3
@Override public void mouseReleased (MouseEvent e) { if (alg.isProcess()) { return; } int i = getRowByMouseX(e.getX()); int j = getColumnByMouseY(e.getY()); draggedCell = null; alg.reset(); if (e.getButton() == MouseEvent.BUTTON1 && alg.getCell(i...
5
public void updateFile(File file){ this.file = file; }
0
* @param unit The missionary <code>Unit</code>. * @param settlement The <code>IndianSettlement</code> to establish at. * @return An <code>Element</code> encapsulating this action. */ public Element establishMission(ServerPlayer serverPlayer, Unit unit, IndianSettle...
7
public boolean getPassedPoint(int i){ return passedPoint[i]; }
0
private void parsePacket(byte[] data, InetAddress address, int port) { String message = new String(data).trim(); PacketTypes type = Packet.lookupPacket(message.substring(0, 2)); Packet packet = null; switch (type) { default: case INVALID: break; case LOGIN: packet = new Packet00Login(data); handl...
7
@SuppressWarnings("unchecked") private static <T extends Object> T getValue(T object, String strFieldName) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { Class<T> d = (Class<T>)object.getClass(); T e = object; String[] fieldnames = strFieldName.split("\\."); for (in...
7
public String getTaxes(String s) { String taxValue = "17"; return taxValue; };
0
public void getTransitionsFromCPN(Document doc, PetriNet pn) { NodeList transList = doc.getElementsByTagName("trans"); for (int i = 0; i < transList.getLength(); i++) { Node nNode = transList.item(i); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eEleme...
6
public void addSegment(Segment s){ if(s.getRoadID() == this.roadID){ segments.add(s); } }
1
public float getK() { return this.k; }
0
public Elevator callDown(Rider r){ int startFloor = r.getFrom(); while(true) { for(Elevator e : elevators) { synchronized(e){ if(!e.isGoingUp() && e.getFloor()>startFloor) { e.addRequest(r); return e; } else if(!e.isInTransit()) { e.addRequest(r); return e; } }...
5
public static TreeSet<Association> mergeArrays( ArrayList<Association> associations, ArrayList<Association> fClusterAssociations, ArrayList<Association> left) { TreeSet<Association> combine = new TreeSet<Association>(); for (Association a : associations) combine.add(a); for (Association a : fClusterAs...
3
public void updatePositions() { playerAlive = new ArrayList<ChessPiece>(); aiAlive = new ArrayList<ChessPiece>(); for (int i = 0; i < gameState.length; i++) { for (int j = 0; j < gameState[0].length; j++) { gameState[i][j].setRow(i); gameState[i][j].setCol(j); if (gameState[i][j].getColor() == play...
7
@Override protected void repondreExtension(HttpServletRequest requete, HttpServletResponse reponse, String action, Utilisateur utilisateur) throws ServletException, IOException { if (utilisateur != null) { throw new DejaConnecteException(); } String pseudo = requete.getParameter...
7
public void setWindowPadding(int[] padding) { if ((padding != null) && (padding.length != 4)) { IllegalArgumentException iae = new IllegalArgumentException("The padding-array must have four elements!"); Main.handleUnhandableProblem(iae); } this.window_Padding = padding; ...
2
private Particulier createParticulier(HttpServletRequest request) throws Exception{ String email = request.getParameter("email"), motDePasse = request.getParameter("motdepasse"), motDePasse2 = request.getParameter("motdepasse2"), nom = request.getParameter("nom")...
4
public void run() { //open a socket to the server and send data try { //get the user command (put, get, delete) if(this.commandType.equals("put") || this.commandType.equals("del") || this.commandType.equals("reb")) { //System.out.println("issuing put to server"); getServerResponse(); } el...
7
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (!par1World.isRemote) { int var6 = par1World.getBlockMetadata(par2, par3, par4); if ((var6 & 8) != 0) { par1World.setBlockMetadataWithNotify(par2, par3, ...
6
public static int editex(String string1, String string2){ char[] str1 = ("#" + string1).toCharArray(); char[] str2 = ("#" + string2).toCharArray(); int length1, length2; length1 = str1.length; length2 = str2.length; int F[][] = new int[length1][length2]; int dStr...
4
public void setComponent(GuiComponent component) { InputHandler.getInstance().clearAll(); if (activeComponent != null) { activeComponent.deactivate(); } component.activate(); activeComponent = component; }
1
public void setFesEstado(String fesEstado) { this.fesEstado = fesEstado; }
0
private void setOthers(ColorFilter filter, String replacing, String test, int testValue, int otherValue, int testGap, int otherGap, int shift) { boolean set = false; if (shift == LEFT_SHIFT) { filter.setShift("left"); } else if (shift == RIGHT_SHIFT) { filter.setShift("right"); } else { if (replacing....
4
private static byte[][] InvShiftRows(byte[][] state) { byte[] t = new byte[4]; for (int r = 1; r < 4; r++) { for (int c = 0; c < Nb; c++) t[(c + r)%Nb] = state[r][c]; for (int c = 0; c < Nb; c++) state[r][c] = t[c]; } return state; }
3
@Override public String execute() { Polynomial result = new Polynomial(); Multiply mul = new Multiply(); Sum sum = new Sum(); Polynomial minus = new Polynomial(); Polynomial temp; Term c; minus.addTerm(-1,1,0); Term a = divisor.termAt(0); Term ...
4
public Dimension getSize() { Dimension dim = super.getSize(); if (!layingOut) { if (isAutoPopupWidth) { popupWidth = getOptimumPopupWidth(); } if (popupWidth != 0) { dim.width = popupWidth; } } return dim; ...
3
public boolean opEquals(Operator o) { return (o instanceof ThisOperator && ((ThisOperator) o).classInfo .equals(classInfo)); }
1
@Override public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); switch (keyCode) { case KeyEvent.VK_UP: U = true; break; case KeyEvent.VK_W: U = true; break; case KeyEvent.VK_DOWN: D = true; break; case KeyEvent.VK_S: D = true; break; case KeyEvent.VK_LEFT: L = tru...
8
private void movement() { if (game.getInput().down.down) { if (canDown) game.yOffset += speed; directionFacing = Down; } if (game.getInput().up.down) { if (canUp) game.yOffset -= speed; directionFacing = Up; } if (game.getInput().left.down) { if (canLeft) game.xOffset -= speed; d...
8
public ArrayList<Integer> getTransitionStartToGoal( int startID, int goalID ){ ArrayList<Integer> transition = new ArrayList<Integer>(); transition.add( goalID ); while(true){ int to = transition.get(transition.size()-1); int from = getNode(to).getFromID(); if( from < 0){ //どこからもたどり着かなかった break; ...
3
public DriveTrain() { _leftEncoder.start(); _rightEncoder.start(); LiveWindow.addSensor ("Drive Train", "Gyro", _gyro); LiveWindow.addSensor ("Drive Train", "Left Encoder", _leftEncoder); LiveWindow.addSensor ("Drive Train", "Right Encoder", _rightEncoder); }
0
public void drawGeometry(Graphics g) { int radius = (int) ((Math.abs(topLeft.distance(bottomRight)))); if ((topLeft.y > bottomRight.y) && (topLeft.x < bottomRight.x)) { g.drawOval(topLeft.x, bottomRight.y, radius, radius); } else if ((topLeft.y < bottomRight.y) && (topLeft.x >bottomRight.x)) { g.drawOva...
6
@Override public List<Pessoa> Buscar(Pessoa obj) { String consulta = "select l from Pessoa l"; if(obj != null){ consulta = consulta + " where l.nome like '%" + obj.getNome() + "%'"; } Query q = manager.createQuery(consulta); return q.getResultLis...
1
public final void comment(final char[] ch, final int off, final int len) throws SAXException { try { closeElement(); writeIdent(); w.write("<!-- "); w.write(ch, off, len); w.write(" -->\n"); } catch (IOException ex) { throw new SAXException(ex); } }
1
public void addNode(Node node) { if (node instanceof StartEvent) { if (startEvent != null && startEvent != node) { throw new ASFModelException("Multiple StartEvent has been found!"); } this.startEvent = (StartEvent) node; } else if (node instanceof End...
7
@Override public boolean tick(Tickable ticking, int tickID) { if((tickID==Tickable.TICKID_TRAP_RESET)&&(getReset()>0)) { // recage the motherfather if((tickDown<=1)&&(monsters!=null)) { for(int i=0;i<monsters.size();i++) { final MOB M=monsters.get(i); if(M.amDead()||(!M.isInCombat())) ...
7
private String setFPCBindings(String script) { Bindings engineBindings = getContext().getBindings(ScriptContext.ENGINE_SCOPE); Bindings globalBindings = getContext().getBindings(ScriptContext.GLOBAL_SCOPE); StringBuilder varNames = new StringBuilder(); for (String key : engineBindin...
7
private void printKClosest(int arr[],int x,int k){ //Find the Crossover point to get the left index int left=findCrossOver(arr,0,arr.length-1,x); //Find the right index int right=left+1; //To Keep track of the elements already counted int count=0; //if the element is present in the array...
9
public void mouseDown(MouseEvent event) { if (event.button != 1) return; getPaintSurface().setStatusMessage(PaintExample.getResourceString( "session.SegmentedInteractivePaint.message.interactiveMode")); previousFigure = currentFigure; if (controlPoints.size() > 0) { final Point lastPoint = (Point) contr...
4
@Override protected T readNext() { try { if (reader.ready()) { while ((line = reader.readLine()) != null) { // Read a line (only if needed) if (!line.trim().isEmpty()) { // Non empty line? Create object lineNum++; return createObject(line); } } } } catch (IOException e) { ret...
4
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!CMLib.flags().isAliveAwakeMobile(mob,false)) return false; final Ability A=mob.fetchEffect(ID()); if(A!=null) { A.unInvoke(); mob.tell(L("You end your all-out defensive posture."));...
8
public double Daf2r(int ideg, int iamin, double asec) throws palError { /* Preset status */ Status = 0; double rad = 0.0; TRACE("Daf2r"); /* Validate arcsec, arcmin, deg */ if ((asec < 0.0) || (asec >= 60.0)) { Status = 3; throw new palError(Statu...
6