text
stringlengths
14
410k
label
int32
0
9
@Override protected void run() { long startTime = System.currentTimeMillis(); long elapsedTime = 1; ClonAlg clonAlg = (ClonAlg) algorithms.get("ClonAlg"); int sameCounter = 0; clonAlg.run(); runBestIndividual = clonAlg.getBestIndividual(); System.out.println(); boolean reset = false; w...
4
@Override public void collideWith(Element e) { if (isActive() && e instanceof PlayerCTF) ((PlayerCTF) e).dropFlagOnAdjacentPosition(getGrid().getElementPosition(this)); super.collideWith(e); }
2
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Physical target=getAnyTarget(mob,commands,givenTarget,Wearable.FILTER_UNWORNONLY); if(target==null) return false; if(target==mob) { mob.tell(L("@x1 doesn't look dead yet.",target.nam...
7
public void actionPerformed(ActionEvent e) { if ("hit".equals(e.getActionCommand())) { this.game.hit(this.hp, 1); resetScore(); } else if ("stay".equals(e.getActionCommand())) { stayStuff(); } else if ("reset".equals(e.getActionCommand())) { resetGame(); } else if ("bet +10".equals(e.getActionComman...
9
@Override public void initialize(Vertex start) { this.queue = new Queue(); for (int i = 0; i < edges.getSize(); i++) { edges.get(i).setVisited(false); } for (int i = 0; i < vertices.getSize(); i++) { vertices.get(i).setColor(VertexColor.WHITE); ver...
2
public static void maxHeapify(int[] a, int i, int heapSize) { int left = left(i); int right = right(i); int largest = i; if (left <= heapSize && a[left] > a[i]) { largest = left; } if (right <= heapSize && a[right] > a[largest]) { largest = right; } if (largest != i) { swap(a, i, largest); ...
5
public static void main(String[] args) { List<String> maleTeam = new LinkedList<>(); maleTeam.add("John"); maleTeam.add("Tom"); maleTeam.add("Sam"); maleTeam.add("Vijay"); maleTeam.add("Anthony"); System.out.println("Male Team:" + maleTeam); List<String> femaleTeam = new LinkedList<>(); femaleTeam.add...
2
public Missile(Player player, Start start, int dir, int heigth, int width, GameScreen gameScreen, List<BasicZombie> basicZombieList, Boss boss) { this.player = player; this.dir = dir; this.heigth = heigth; this.width = width; this.gameScreen = gameScreen; this.start = start; this.basicZombieList = basi...
5
private boolean onkoNopeusToisestaPois(Pelihahmo h){ double toisenSuunta = normalisoi(hahmojenValinenKulma(h)); double nopeus = normalisoi(nopeudenSuunta(h)); return nopeus < normalisoi(toisenSuunta - Math.PI/2) && nopeus > normalisoi(toisenSuunta + Math.PI/2); }
1
@EventHandler public void createSignEvent(SignChangeEvent event) { if (event.isCancelled()) return; Player player = event.getPlayer(); Block block = event.getBlock(); if (event.getLine(0).equalsIgnoreCase("[Teleporter]")) { if (!player.hasPermission("TeleportManager.sign.create")) { player.sendMessage(C...
3
public static byte[] decodeFromFile(String filename) throws java.io.IOException { byte[] decodedData = null; Base64.InputStream bis = null; try { // Set up some useful variables java.io.File file = new java.io.File(filename); byte[] buffer = null; int length = 0; int numBytes = 0; // Check ...
4
public String addUser() { try { User user = new User(); user.setId(getId()); user.setName(getName()); user.setSurname(getSurname()); userService.addUser(user); return SUCCESS; } catch (DataAccessException e) { e.printSta...
1
public static void main(String[] args) { if (args.length != 1) { System.err.println("usage: java Registrar [integer]"); System.exit(1); } int n = Integer.parseInt(args[0]); Registrar server = new Registrar(n); Utils.out(server.pid, String.format("Registrar started; n = %d.",n)); ServerSocket se...
4
protected void setDecomposition(int[] decomposition) { tempDecomposition = decomposition; }
0
public static void actWhenMassiveAttackIsPending(Unit unit) { // If unit is surrounded by other units (doesn't attack alone) // if (isPartOfClusterOfMinXUnits(unit)) { // If there is attack target defined, go for it. if (StrategyManager.isSomethingToAttackDefined() && !MapExploration.getEnemyBuildingsDisc...
7
public void giveIntervalReward(Player p, int breaks) { if (intervalRewards == null || intervalRewards.isEmpty()) { return; } for (Reward r : intervalRewards.values()) { if (breaks % r.getBlocksNeeded() == 0) { if (r.getCommands() == null || r.getCommands().isEmpty()) { return; } ...
9
public void mouseClicked(MouseEvent event) { GrammarTable gt = (GrammarTable) event.getSource(); Point at = event.getPoint(); int row = gt.rowAtPoint(at); if (row == -1) return; if (row == gt.getGrammarModel().getRowCount() - 1) return; Production p = gt.getGrammarModel().getProduction(row); ...
3
public static void matrixsum(int x[][]) { int sumr = 0, sumc[], sumd1 = 0, sumd2 = 0; sumc = new int[x[0].length]; for (int i = 0; i < x.length; i++) { sumr = 0; System.out.print("\n "); for (int j = 0; j < x[i].length; j++) { System.out.print(x[i][j] + " "); sumc[j] = sumc[j] + x[i][j]; ...
5
public void printConfusionMatrix() { // print header System.out.println("Confusion Matrix:\n"); System.out.format("%20s", ""); for (String classifier : testInstances.classifiers()) { System.out.format("%20s | ", classifier); } System.out.println("\n"); // get set of classifiers Set<String> classifier...
6
private static void findHelp(BoggleBoard board, LexiconInterface lex, int min, int r, int c, AutoPlayerBoardFirst ap, String word, ArrayList<BoardCell> cellList){ cellList.add(new BoardCell (r, c)); if(lex.containsPrefix(word)){ if(lex.contains(word) && word.length() >= min && !ap.myWords.contains(word)){ ...
8
private void addPart(int gridX, int gridY, int dir, int amount) { Random random = new Random(); amount += 2; if (gridY < cloudAtlas.length && gridX < cloudAtlas[0].length - 1 && gridX > -1 && gridY > -1) { //System.out.println("dir: " + dir + " adding cloud: " + gridX + " " + gridY)...
9
public String getNombre() { return nombre; }
0
static final public NamesValues namesValuesOf(Map map){ if (map == null){ return new NamesValues(new String[0],new Object[0]); } Object[] keys = map.keySet().toArray(); String[] names = new String[keys.length]; Object[] vals = new Object[keys.length]; for (int i = 0 ; i < vals.length; i++){ Object k...
2
@Test public void testWritePriceForQuantity() throws Exception { BigDecimal bd1 = BigDecimal.valueOf(150.00); product.writePriceForQuantity(7, bd1); assertTrue(product.getPrices().get(7).equals(bd1)); }
0
private Object unwrapValue(Object value) { if (value == null) return null; if (value instanceof Wrapper) { return ((Wrapper) value).getHandle(); } else if (value instanceof List) { throw new IllegalArgumentException("Can only insert a Wra...
4
private void addPlanets(Point3 startPoint, Point3 parallSize, int count ){ Random rand = new Random(); int maxLoopEntries = 10000; //чтоб бесконечно не крутился while(count > 0 && maxLoopEntries>0){ maxLoopEntries--; Point3 randPoint = new Point3( ra...
5
public void addKey(int keyEvent, Key key) { if (keys.containsKey(keyEvent)) { keys.get(keyEvent).add(key); } else { ArrayList<Key> newKeyList = new ArrayList<Key>(); newKeyList.add(key); keys.put(keyEvent, newKeyList); } }
1
public double[] columnStandardErrors(){ double[] standardErrors = new double[this.numberOfRows]; for(int i=0; i<this.numberOfColumns; i++){ double[] hold = new double[this.numberOfRows]; for(int j=0; j<this.numberOfRows; j++){ hold[i] = this.ma...
2
public ParkingSpot searchBySpotNumber(String number) { ParkingSpot spot = null; for(TreeSet<ParkingSpot> t: garage.values()) for(ParkingSpot p: t) if(p.getParkingNumber().equalsIgnoreCase(number)) spot = p; return spot; }
3
public void editTask(HabitItem task) { boolean flag=false; int i=0; while(i<this.items.size() && flag!=true) { if(this.items.get(i).getId().equals(task.getId())) { flag=true; } else { i++; } } if(flag) { this.items.set(i, task); } }
4
public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) { buf.setLength(0); buf.append('\n'); if ((access & Opcodes.ACC_DEPRECATED) != 0) { buf.append(tab).append("// DEPRECATED\n"); } buf.append(tab).append("// access flags 0x")...
5
public static boolean hasNonVowel(String text) { int c = 0; for(int i = 0; i < text.length(); i++) { if(text.charAt(i) == 'a' || text.charAt(i) == 'e' || text.charAt(i) == 'i' || text.charAt(i) == 'o' || text.charAt(i) == 'u') c++; } if(c > 1) return true; else return false; }
7
public TimerunsDataset(String textPath, int step, int count) throws IOException, ParserConfigurationException, SAXException, AnnotationException, XPathExpressionException{ int currIdx = 0; String fullBody= loadBody(textPath); for (int i=0; i<count; i++){ //advance of <step> more words for (int j=0; j<step; ...
9
public void addLocation(String p_Type, int p_X, int p_Y) throws Exception { String add = "add_" + p_Type + "(" + appendPos(p_X, p_Y) + ",A,B)."; SolveInfo info = m_Engine.solve(add); while(info.isSuccess()) { String x = info.getVarValue("A").toString(...
2
private void modificarDatos(){ idLabel.setText(Integer.toString(cliente.getIdCliente())); nombre.setText(cliente.getNombre()); apellidos.setText(cliente.getApellidos()); apodo.setText(cliente.getApodo()); especial.setSelected(cliente.isEspecial()); }
0
public boolean buscar(T dato){ boolean resultado = false; Nodo<T> q = p; while(q != null){ if(q.getValor().equals(dato)){ resultado = true; } q = q.getLiga(); } return resultado; }
2
public int compareTo(Vehicle v) { if (v.getPosition() > this.getPosition()) { return 1; } else if (v.getPosition() < this.getPosition() ) { return -1; } else { return 0; } }
2
public void setOptions(String[] options) throws Exception { String tmpStr; String[] tmpOptions; setChecksTurnedOff(Utils.getFlag("no-checks", options)); tmpStr = Utils.getOption('C', options); if (tmpStr.length() != 0) setC(Double.parseDouble(tmpStr)); else setC(1.0); tmpS...
7
protected static String convertToWikiIndent(String wikiText) { String[] linesArr = wikiText.split("\\n"); for (int i = 0; i < linesArr.length; i++) { if (linesArr[i].trim().isEmpty() == false) { char firstChar = linesArr[i].trim().charAt(0); if (Character.isD...
3
public static void pokemonWasSelected(int pokeIndex, Item item) { if(item.effect1==Item.Effect.POKEBALL) { usePokeBall(item); } else if(item.effect1==Item.Effect.ROD) { useRod(item); } else if(item.effect1==Item.Effect.REPEL) { useRepel(item); } else if (item.effect1 != Item.Effect.TM && i...
8
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(type.toString() + "[" + value + "]"); if (!constraints.isEmpty()) { sb.append("{"); for (Constraint def : constraints) sb.append(def); sb.append("}"); } return sb.toString(); }
2
public void updateMembersList(){ listModelMembers.removeAllElements(); for (String i:admin){ listModelMembers.addElement(i+" (Admin)"); } for (String i:members){ listModelMembers.addElement(i); } for (ExternalUser i:externalUsers){ listModelMembers.addElement(i.getName()+" (External)"); } }
3
public static double betacf(double a, double b, double x) { double MAXIT = 100; double EPS = 3e-7; double FPMIN = 1e-30; int m, m2; double aa, c, d, del, h, qab, qam, qap; qab = a+b; qap = a+1; ...
8
@Override public void actionPerformed(GuiButton button) { if(button.id == 0) { GameStatistics.lives--; MapGenerator gen = new MapGeneratorSimple(); Remote2D.guiList.pop(); Remote2D.guiList.push(new GuiLoadMap(gen, 40, 40, 1337)); } else if(button.id == 1) { while(!(Remote2D.guiList.peek() insta...
3
public static void main(String[] args) throws IOException { readConfigFile(); File file = new File(CONFIG.getEntryFolder()); for (File currentFolder : file.listFiles()) { for (String currentProject : CONFIG.getProjectsToCheck()) { if (currentFolder.getAbsolutePath().e...
7
protected void genDoorName(MOB mob, Exit E, int showNumber, int showFlag) throws IOException { if((showFlag>0)&&(showFlag!=showNumber)) return; if(E instanceof Item) mob.tell(L("@x1. Exit Direction (or 'null'): '@x2'.",""+showNumber,E.doorName())); else mob.tell(L("@x1. Door Name: '@x2'.",""+showNumbe...
8
private int isDPI(String mnemonic) { if(mnemonic.length()!=3 && mnemonic.length()!=5 && mnemonic.length()!=6) { return -1; } String dpiMnemonics[] = {"and","eor","sub","rsb","add","adc","sbc","rsc","tst","teq","cmp","cmn","orr","mov","bic","mvn"}; System.out.print...
5
static public float atan2_fast(float y, float x) { // From: http://dspguru.com/comp.dsp/tricks/alg/fxdatan2.htm float abs_y = y < 0 ? -y : y; float angle; if (x >= 0) angle = 0.7853981633974483f - 0.7853981633974483f * (x - abs_y) / (x + abs_y); else angle = 2.356194490192345f - 0.7853981633974483f * (x...
3
public void visit_switch(final Instruction inst) { final Switch sw = (Switch) inst.operand(); final int[] values = sw.values(); final Label[] targets = sw.targets(); if (values.length == 0) { if (longBranch) { addOpcode(Opcode.opc_pop); // Pop switch "index" off stack addOpcode(Opcode.opc_goto_w); ...
5
public void destroy(Long id) throws NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); Ausencia ausencia; try { ausencia = em.getReference(Ausencia.class, id); a...
2
public Door(Transform transform, Material material, Vector3f openPosition) { this.transform = transform; this.openPos = openPosition; this.closedPos = transform.getPosition(); this.material = material; opening = false; closing = false; open = false; startTime = 0; openTime = 0; closeTime = 0; ...
1
public Builder against(final Object value) { this.value = value; return this; }
0
private void recursivePrint(int i, Node parentNode, int parentPosition, int depthLeft, int depthRight) { int newLeftPosition = 2 * i + 1; Pair left = null; Node nodeLeft = null; int parentLeftPosition = parentPosition; if (newLeftPosition < nodes.length) { left = nod...
6
private boolean handlePlaceBlocked(Player player, Block block, Material type) { if (WorldRegionsPlugin.getInstanceConfig().ENABLE_BLOCKED_PLACE && WGCommon.willFlagApply(player, WorldRegionsFlags.BLOCKED_PLACE)) { // Disabled? if (WGCommon.areRegionsDisabled(player.getWorld())) return true; // Bypass? ...
8
@Override public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { case "Lopeta": System.exit(0); break; case "Kirjaudu ulos": ikkuna.kirjaaUlos(); break; case "Uusi käyttäjätunnus/oppilas...
9
public Tile getTile (int x, int y) { if (x < 0 || x >= width || y < 0 || y >= height) return Tile.voidTile; if (tiles[x + y * width] == Tile.col_grass) return Tile.grass; if (tiles[x + y * width] == Tile.col_floor) return Tile.floor; if (tiles[x + y * width] == Tile.col_wall_1) return Tile.wall_1; if (tiles[x...
8
@Override public Descriptor compile(SymbolTable symbolTable) { Descriptor d = null; if (subject instanceof IdentNode) { d = symbolTable.descriptorFor(((IdentNode) subject).getIdentName()); } if (d instanceof IntConstDescriptor) { write("PUSHI, " + ((IntConstDescriptor) d).value()); } else if (subject...
7
private void process(Kernel kernel, int[] in, int[] out, int width, int height, boolean alpha, boolean wrap) { float[] matrix = kernel.getKernelData( null ); int cols = kernel.getWidth(); int cols2 = cols/2; for (int y = 0; y < height; y++) { int index = y; int ioffset = y*width; for (int x = 0; x < w...
9
public static void craftRunesOnAltar(Client c, int requiredlvl, int exp, int item, int x2, int x3, int x4) { int essamount = 0; if(!hasRequiredLevel(c, 20, requiredlvl, "runecrafting", "craft this runes")) { return; } if (!c.getItems().playerHasItem(1436)) { c.sendMessage("You need some rune essence to cr...
8
public <T> Provider<T> scope(final Key<T> key, final Provider<T> unscoped) { // Memoize call to unscoped.get() under key. return new Provider<T>() { public T get() { ConcurrentMap<Key<T>, Future<T>> futures = futures(); Future<T> f = futures.get(key); ...
5
static private int jjMoveStringLiteralDfa1_0(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(0, active0); return 1; } switch(curChar) { case 97: return jjMoveStringLiteralDfa2_0(active0, 0x20000L); case 10...
5
public static Node nextInorder(Node node) { if (node == null) return null; Node current = node.getRight(); // If current node has right subtree then the next inorder node is // leftmost node in right subtree if (current != null) { while (current.getLeft() != null) current = current.getLeft(); r...
7
private void removecurrentChartPanel(){ if(this.currentChartPanel != null){ try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { TesterMainGUIMode.this.getContentPane().remove(TesterMainGUIMode.this.currentChartPanel); TesterMainGUIMode.this.getContentPane().r...
2
public static void save(String filename) { File file = new File(filename); String suffix = filename.substring(filename.lastIndexOf('.') + 1); // png files if (suffix.toLowerCase().equals("png")) { try { ImageIO.write(onscreenImage, suffix, file); } catch (IOExcep...
4
public static int nextValidInt(Scanner s, int lo, int hi){ Integer input = null; do{ if (s.hasNextInt()){ input = (Integer) s.nextInt(); } else{ // Case: there is no integer in the next input System.out.println("Please input a number."); s.next(); // this prevents build up of empty lines when ...
6
@Override public int compareTo(BussinessMessage o) { if ((getFieldName() == null) && (o.getFieldName() == null)) { return getMessage().compareTo(o.getMessage()); } else if ((getFieldName() == null) && (o.getFieldName() != null)) { return 1; } else if ((getFieldName() ...
9
public void UpdateIndicesOnDelete(Persistent obj) throws IllegalArgumentException, IllegalAccessException { String globalName = obj.GetIndexGlobalName(); NodeReference node = connection.createNodeReference(globalName); Field[] fields = obj.getClass().getFields(); for (int i =0; i< fi...
2
public static boolean hasDivisibilityProperties(String x) { boolean d234by2, d345by3, d456by5, d567by7, d678by11, d789by13, d8910by17; d234by2 = Long.parseLong(x.substring(1, 4)) % 2 == 0; d345by3 = Long.parseLong(x.substring(2, 5)) % 3 == 0; d456by5 = Long.parseLong(x.su...
7
public Fee(JSONObject json) throws JSONException { if (json.has("Amount")) { this.setAmount(json.getString("Amount")); } if (json.has("CurrencyCode")) { this.setCurrencyCode(json.getString("CurrencyCode")); } if (json.has("IncludedInEstTotalInd")) { this.setIncludedInEstTotalInd(json.getString("Inclu...
6
protected void waitForBridgeView(int expected_size, long timeout, long interval, JChannel ... channels) { long deadline=System.currentTimeMillis() + timeout; while(System.currentTimeMillis() < deadline) { boolean views_correct=true; for(JChannel ch: channels) { R...
8
public static void main(String[] args) { ExecutorService exec = Executors.newCachedThreadPool(); ArrayList<Future<String>> results = new ArrayList<Future<String>>(); for (int i = 0; i < 10; i++) /* * <T> Future<T> submit(Callable<T> task) Submits a value-returning * task for execution and returns a ...
4
private void allFalse() { for(boolean bool : keyStates) bool = false; }
1
@Override public List<ValidateException> validate(String parameter) { final int maxPatronymicLength = 30; List<ValidateException> validateExceptionList = new LinkedList<>(); if (!ValidateUtils.stringMaxLengthValidation(parameter, maxPatronymicLength)) { String exMsg = "entered q...
1
@DataProvider(name = DATA_PROVIDER) public Object[][] parameterIntTestProvider() { if (USE_REMOTE_BROWSERS) { return new Object[][] { { new DriverGenerator.RemoteFirefox() }, { new DriverGenerator.RemoteChrome() } }; } else { if(USE_STORED_PROFILE_FOR_FIREFOX){ return new Obje...
2
@Override public void hook(Game game) { String[] statusb = game.getPlayer().toStatus().split("\n"); StringBuilder sb = new StringBuilder(); int cur = 0; for (String statusb1 : statusb) { if (statusb1.contains("\r")) { sb.append(statusb1).append("\n"); ...
6
public int candy(int[] ratings) { if (ratings == null || ratings.length == 0) throw new IllegalArgumentException("Invalid args"); // Arrays.sort(ratings); // sort int n = ratings.length; int num[] = new int[n]; int sum = 0; for (int i = 0; i < n; i++) num[i] = 1; int k = 1; for (int i = 1; i < n...
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Kokus other = (Kokus) obj; if (this.nbkoku != other.nbkoku) { return false; } ...
3
private long updateRewrite(Master master, File f, Location accessLoc, int rewriteCount) { MasterMeta fm = null; if (master.map.containsKey(f.getId())) { fm = master.map.get(f.getId()); } else { fm = new MasterMeta(f); master.map.put(f.getId(), fm); } int cCount = master.clusters.s...
8
private void findLastUsage_BFS() { // TODO Auto-generated method stub List<Unit> first_node = graph.getHeads(); if(first_node.size()>1){ return; } queue.add(first_node.get(0)); units_already_seen.add(first_node.get(0)); while(!queue.isEmpty()){ Unit u = queue.remove(); List<Local> vr = sll....
5
private boolean testHypothesis() { if (hypothesis == Hypothesis.LESS_THAN && testStatistic < criticalRegion) { return true; } else if (hypothesis == Hypothesis.GREATER_THAN && testStatistic > criticalRegion) { return true; } ...
7
private static String getShortMachineID() throws Exception { String MachineID = null; String localIP=null; String timestamp=null; try{ Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()){ NetworkInterface current = interfaces.nex...
8
void objectParsed(Object what) { if (logger.isDebugEnabled()) { logger.debug("objectParsed()"); } inParams.addElement(what); }
1
private GameObject GetRootObject() { if(m_root == null) m_root = new GameObject(); return m_root; }
1
public static double getDouble() throws BadInput { double num; try { String str = getString(); num = Double.parseDouble(str); } catch(NumberFormatException e) { throw new BadInput(); } return num; }
1
public void restoreBackedUpTiles(){ System.out.println("restoring backed up tiles: " + backUpNum); //backUpGoBack(); if(backUpMaps.size() > 0){ int[][][] vecArray = backUpMaps.get(backUpNum); int[][][] temp = new int[vecArray.length][vecArray[0].length][vecArray[0][0].length]; for(int k = 0; k < vecArray...
3
private void insertUserRoles(String email, Role role, Connection conn) throws SQLException { PreparedStatement st = null; String q; try { switch (role) { case administrator: { q = "INSERT INTO user_roles SET email = ?, roles = ?"; ...
5
@Override public void draw(Graphics g) { if (acceptingUserInput() && !captured && closeEnough()) { //illustrate basics g.setColor(Color.LIGHT_GRAY); Point pt = getClosestPt(); g.drawLine(getMouseLoc().x, getMouseLoc().y, pt.x, pt.y); } if (acceptingUserInput() && captured) { //illustrate ch...
5
public Ellipse2D getShape() { return new Ellipse2D.Double(x, y, XSIZE, YSIZE); }
0
private DoubleDate handleUntimedTask(String[] words, int indexOfDate1, int indexOfDate2, int indexOfFrom, int indexOfTo) { DoubleDate result = null; boolean noTime = false; boolean isNext = false; if (indexOfDate1 != words.length - 1 && indexOfDate1 > -1) { String...
8
@Override public void update(Observable model, Object msg) { ObserverMessage message = (ObserverMessage) msg; if (msg instanceof ObserverMessage) { if (message.getMessage()==ObserverMessage.NEW_LOG_MESSAGE) { String logmessage = ((AutoDJModel) model).getLogtext(); if (!logmessage.endsWith("\n")) logmess...
5
public void connect(String host, int major, int minor, String key) { this.host = host; this.major = major; this.minor = minor; this.key = key; try { socket = new Socket(host, 43594); input = socket.getInputStream(); output = socket.getOutputStream(); ByteBuffer buffer = ByteBuffer.al...
1
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Train train = (Train) o; if (id != train.id) return false; if (totalSeats != train.totalSeats) return false; if (departure != null ? !d...
9
void setLink() { final Shell dialog = new Shell(shell, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM); dialog.setLayout(new GridLayout(2, false)); dialog.setText(getResourceString("SetLink")); //$NON-NLS-1$ Label label = new Label(dialog, SWT.NONE); label.setText(getResourceString("URL")); //$NON-NLS-1$ final Text...
4
@Override public synchronized void setName(String name) { this.name = name; }
0
private void handleDropItem(Message m, GameSession s) { Player p = s.getPlayer(); m.readInt(); int slot = m.readLEShortA() & 0xFFFF; m.readLEShort(); if(slot < 0 || slot >= 28 || p.getInventory().get(slot) == null) { return; } Item item = p.getInventory().get(slot); World.getSingleton().getGroundItem...
3
public void heapify(int indeksi){ int vasen = left(indeksi); int oikea = right(indeksi); int pienin; if(oikea <= heapsize){ if(keko[vasen].getPaino() < keko[oikea].getPaino()){ pienin = vasen; } else{ pienin = oikea; ...
5
public void updateCurrentPoints(PlayerCharacter girl) { double value = 0; String message = ""; if (challengeNumber == 1) { value = attributes.get(0).getAttributeValue(); } else if (challengeNumber == 2) { value = attributes.get(1).getAttributeValue(); } else if (challengeNumber == 3) { value = att...
7
@EventHandler(priority = EventPriority.HIGH) public void onBlockDamage(BlockDamageEvent event) { if (event.isCancelled()) return; Block bl = event.getBlock(); Location loc = bl.getLocation(); if (bl.getType().equals(Material.ANVIL)) { if (plugin.anvils.containsKey(loc)) { ItemStack hand = event.get...
5
private final long method714(int i) { long l = System.nanoTime(); long l2 = 0L; long l1 = -aLong3105 + l; aLong3105 = l; if (0xfffffffed5fa0e00L < l1 && ~l1 > 0xfffffffed5fa0dffL) { aLongArray3103[anInt3104] = l1; anInt3104 = (1 + anInt3104) % 10; ...
5
private void setPopupMenu(JComponent component) { //Создаем контекстное меню final JPopupMenu popup = new JPopupMenu(); JMenuItem menuItem = new JMenuItem("Отменить заявку"); popup.add(menuItem); //Добавляем слушателя на нажатие кнопки меню и на показ контекстного меню me...
1