text
stringlengths
14
410k
label
int32
0
9
@Test public void randomTest() { final Random rng = new Random(1337); for(int n = 0; n < 1_000; n++) { Array<Integer> arr = emptyArray(); final ArrayList<Integer> list = new ArrayList<Integer>(n); for(int i = 0; i < n; i++) { final int insPos = rng.nextInt(i + 1); arr = arr.ins...
8
public void runServer(ConfigurationForServer configuration) { configuration.setProperties(properties); if (configuration.isInvalid()) exitStatus = 1; if (configuration.showHelp()) { System.out.println(configuration.getHelpText()); } else { try { ...
3
public void fireMarkerEvent(final MarkerEvent EVENT) { final EventHandler<MarkerEvent> HANDLER; final EventType TYPE = EVENT.getEventType(); if (MarkerEvent.MARKER_EXCEEDED == TYPE) { HANDLER = getOnMarkerExceeded(); } else if (MarkerEvent.MARKER_UNDERRUN == TYPE) { ...
3
private void generateMethod(Method method, String className) { CodeVisitor mw = _classWriter.visitMethod(method.getModifiers() ^ ACC_ABSTRACT, method.getName(), ...
9
private String shrtTip() { String tt = shorttip(); if (tt != null) { tt = RichText.Parser.quote(tt); if (meter > 0) { tt = tt + " (" + meter + "%)"; } if (FEP != null) { tt += FEP; } if (curio_stat != null && qmult > 0) { if(UI.instance.wnd_char != null) tt += "\nLP: $col[205,205,...
7
private boolean Recargo(float importe) { if (importe < 0) { return false; } if (importe > saldo) { return false; } saldo -= importe; return true; }
2
@SuppressWarnings("unchecked") private static <E extends Comparable<E>> void merge(E[] array, int leftStart, int leftEnd, int rightStart, int rightEnd) { int length = rightEnd - leftStart + 1; E[] mergedArray = (E[]) Array.newInstance(array[0].getClass(), length); int index = leftStart; for (int i = 0; i < ...
5
private static OAuthError extractErrorMessage(String jsonText) { OAuthError oauthError = new OAuthError(); try { JsonFactory jsonFactory = new JsonFactory(); JsonParser jParser = jsonFactory.createJsonParser(jsonText); while (jParser.nextToken() != JsonToken.END_OBJECT) { String fieldname = jParse...
8
public void layout () { if (sizeInvalid) { computeSize(); if (lastPrefHeight != prefHeight) { lastPrefHeight = prefHeight; invalidateHierarchy(); } } SnapshotArray<Actor> children = getChildren(); float groupWidth = getWidth(); float x = 0; float y = getHeight(); float maxHeight = 0; fo...
5
public static boolean isThis(Expression thisExpr, ClassInfo clazz) { return ((thisExpr instanceof ThisOperator) && (((ThisOperator) thisExpr) .getClassInfo() == clazz)); }
1
private void applyRegexHighlighting(JTextComponent comp, Pattern pattern) { Matcher matcher = pattern.matcher(comp.getText()); Highlighter h = comp.getHighlighter(); h.removeAllHighlights(); while(matcher.find()) { try { h.addHighlight(matcher.start(), matcher.end(), regexP...
2
public void removeFiles(List<String> names) { if (names == null) { throw new IllegalArgumentException("names is null"); } boolean changed = false; for (String name : names) { if (name == null) { throw new IllegalArgumentException("names contains a ...
5
public TupleFour<String[], Integer, String, String[]> [] countNetLogoTurtles(TupleFour<String[], Integer, String, String[]> [] agentDetails) throws Exception { TupleFour<String[], Integer, String, String[]> [] returnArray = agentDetails; int typesOfAgent = 0; int noAgentsFound = 0; while(true) { try...
9
public void handleKeyRelease(int value) { switch (value) { case MinuetoKeyboard.KEY_UP: this.keyUp = false; break; case MinuetoKeyboard.KEY_LEFT: this.keyLeft = false; break; case MinuetoKeyboard.KEY_RIGHT: this.keyRight = false; break; case MinuetoKeyboard.KEY_DOWN: this.ke...
4
private void teleport(CommandSender sender, String[] args) { if (!sender.hasPermission("graveyard.command.teleport")) { noPermission(sender); return; } else if (!(sender instanceof Player)) { noConsole(sender); return; } if (args.length == ...
4
public static ArrayList<BufferedImage[]> loadMultiAnimation(int[] frames, int width, int height, String path){ try { ArrayList<BufferedImage[]> sprites; final BufferedImage spritesheet = ImageIO.read(Images.class.getClass().getResourceAsStream(path)); sprites = new ArrayList<BufferedImage[]>(); for (int...
3
static public String removeExtraSlash(String inStr) { int slashLoc = inStr.indexOf("://"); int l = inStr.length(); int hold = slashLoc + 3; slashLoc = inStr.indexOf("//", hold); while (slashLoc > 0 && slashLoc < l) { hold = slashLoc; while (hold < l && inStr.charAt(hold) == '/') hold ++; if (h...
5
private void processInheritanceMap() { for (Iterator<String> it = inheritenceMap.keySet().iterator(); it.hasNext(); ) { String childType = it.next(); String parentType = inheritenceMap.get(childType); if (!childType.isEmpty() && !parentType.isEmpty()) { VariableMap childAttrs = typeAttrMap.get(...
8
public void resetAllGameActions() { for (int i=0; i<keyActions.length; i++) { if (keyActions[i] != null) { keyActions[i].reset(); } } for (int i=0; i<mouseActions.length; i++) { if (mouseActions[i] != null) { mouseActions[i].re...
4
public String toString() { String s = (returnType != null) ? returnType.debugName() : "NULL TYPE"; //$NON-NLS-1$ s += " "; //$NON-NLS-1$ s += (selector != null) ? new String(selector) : "UNNAMED METHOD"; //$NON-NLS-1$ s += "("; //$NON-NLS-1$ if (parameters != null) { if (parameters != Binding.NO_PARAMETERS) { ...
7
public initiateRemoval() { this.requireLogin = true; this.addParamConstraint("id", ParamCons.INTEGER); this.addRtnCode(405, "permission denied"); this.addRtnCode(406, "venue not found"); this.addRtnCode(407, "already removing"); }
0
private void acao139() throws SemanticError { int numeroEsperado = idMetodoChamado.getParametros().size(); if(numeroParametrosAtuais != numeroEsperado) throw new SemanticError("Número de parâmetros atuais deveria ser " + numeroEsperado); }
1
public boolean estCleValable(String k) { int i=0; boolean trouve=false; while(i<k.length() && !trouve) { if(!ALPHABET.contains(""+k.charAt(i))&&!ALPHABET.toUpperCase().contains(""+k.charAt(i))&&(k.charAt(i)!=' ')) { trouve=true; JOptionPane.showMessageDialog(null, "Veuillez saisir une cl constitue uniq...
5
@Override public void actionPerformed(ActionEvent e) { try { JFileChooser chooser = new JFileChooser(); UIManager.put("FileChooser.fileNameLabelText", "Имя файла:"); UIManager.put("FileChooser.saveInLabelText", "Каталог:"); UIManager.put("FileChooser.filesOfTypeLa...
2
@Override public void move(){ if(side == true){ if(!engine.getPhysics().canMove(this, this.getLocation().getX()+5, this.getLocation().getY()+5)) engine.getPhysics().usePhysics(this, this.getLocation().getX()+5, this.getLocation().getY()); else { side = false; setNext(1);} ...
7
public static LevelState getLevel(int level) { Gilbert gilbs; ArrayList<Planet> planetsArray; Collectable collect; switch (level) { case 1: // gilbert gilbs = new Gilbert(800, 600, -1, 0); // planets array planetsArray = new ArrayList<>(); planetsArray.add...
9
public MicroRequestHandler(Vector<File> imageQueue) { this.imageQueue = imageQueue; }
0
private TreeElement handleClass(HashMap classes, ClassInfo clazz) { if (clazz == null) return root; TreeElement elem = (TreeElement) classes.get(clazz); if (elem != null) return elem; elem = new TreeElement(clazz.getName()); classes.put(clazz, elem); if (!clazz.isInterface()) { ClassInfo superCla...
6
private long parseFileDate(String age, String fileName, String folderPath) { Pattern p = Pattern.compile(" "); String [] splitted = p.split(age); long count = Long.parseLong(splitted[0]); long date = (new Date()).getTime(); long fileDate = 0; long step = 0; if (sp...
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final CanDDeliveryOrderItemDetailPK other = (CanDDeliveryOrderItemDetailPK) obj; if (!Objects.equals(this.szDoc...
5
public void run() { ar.configure(ClientActionRobot.intToByteArray(id)); //load the initial level (default 1) ar.loadLevel(); GameState state; while (true) { state = solve(); //If the level is solved , go to the next level if (state == GameState.WON) { System.out.println(" loading...
8
public static int findKth(int[] A, int A_start, int[] B, int B_start, int k) { if (A_start >= A.length) return B[B_start + k - 1]; if (B_start >= B.length) return A[A_start + k - 1]; if (k == 1) return Math.min(A[A_start], B[B_start]); int A_key = A_start + k / 2 - 1 < A.length ? A[A_start + k / 2 ...
6
public Timer getTimer() { boolean test = false; if (test || m_test) { System.out.println("Game :: getTimer() BEGIN"); } if (test || m_test) { System.out.println("Game :: getTimer() END"); } return m_timer; }
4
static private void setDB(int skipStage) { try { //First we try and see if we have our databasefile in the same working directory String pa = Paths.get("").toAbsolutePath().toString() + File.separator + "MICEDB.FDB"; DB.setPath(pa); } catch (InfException e) { // we di...
9
public Object nextContent() throws JSONException { char c; StringBuilder sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new St...
7
public ClientInfo(String t_name, String t_ip, int t_portId) { name = t_name; ip = t_ip; portId = t_portId; }
0
private static String getCommandName(String commandAsStr) { int whiteSpaceIndex = commandAsStr.indexOf(" "); if (whiteSpaceIndex == -1) { return commandAsStr; } String commandName = commandAsStr.substring(0, whiteSpaceIndex); return commandName.trim(); }
1
public void test(){ assert state == State.OK; // get the internal thread number int i = getInternalThreadId(); // activate setState(i, State.GUARD); try{Thread.sleep(1+i);}catch(Throwable ignore){}; // guard if( getState(i+1) != State.IDLE ){ setState(i, State.WAIT); } else{ setS...
7
public static void startupQuery() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ((Module...
7
public static int HeapExtractMax(List<Integer> array){ if(array.size() < 1){ System.out.println("Nothing in heap..."); } int maximum = array.get(0); array.set(0, array.get(array.size()-1)); array.remove(array.size()-1); MaxHeapify(array, 1); return maximum; }
1
public static int check(Point point, Rectangle bounds) { int value = 0; if (point.x == bounds.left) { value |= LEFT; } if (point.x == bounds.right) { value |= RIGHT; } if (point.y == bounds.top) { value |= TOP; } if (poi...
4
private void doType(int keycode) { boolean shift = (keycode != KeyEvent.VK_ENTER && ((keyboard.getShifts() & (1 << SHIFT)) != 0)); boolean ctrl = (keycode != KeyEvent.VK_ENTER && ((keyboard.getShifts() & (1 << CTRL)) != 0)); boolean alt = (keycode != KeyEvent.VK_ENTER && ((keyboard.getShifts() & (1 << ALT)) != 0)...
9
public boolean type(char key, java.awt.event.KeyEvent ev) { if ((key >= '0') && (key <= '9')) { int opt = (key == '0') ? 10 : (key - '1'); if (opt < menuOptions.length) wdgmsg("cl", opt); ui.grabkeys(null); return (true); } else if (key == ...
5
public static void updateLocale(Language language) { String l = Settings.getLocaleLanguage().getLanguageString(); String c = Settings.getLocaleLanguage().getCountryString(); Locale currentLocale = new Locale(l, c); PropertyResourceBundle localeRes = null; try (FileInputStream fi...
4
@Override protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken) throws AuthenticationException { String password = (String)usernamePasswordAuthenticationToken.getCredentials(); if (!StringUtils.hasText(password)) { l...
4
public void processBill() { QueryWarehouse bank = new QueryWarehouse(); Date date = new Date(); String currentDate = df.format(date); int compid = this.getCompanyIdCombo(comboCompany.getSelectedIndex()); String tempQuery = "insert into joincompany_member_hdr (billdt) values (...
7
public static void main(String[] args) { try { List<Thread> threads = new ArrayList<Thread> (CLIENTS); JobDispatcher dispatcher = new JobDispatcher(); dispatcher.start(); JobProcessingService service1 = new JobProcessingService("1"); JobProcessingService service2 = new JobProcessingService("2"); J...
5
public void insert(Player player) throws NamingException { String INSERT_STMT="insert into player(name,address,city,province,postal_code) values(?,?,?,?,?)"; // JDBC variables DataSource ds = null; Connection connection = null; PreparedStatement insert_stmt = ...
9
public AttributeInfo copy(ConstPool newCp, Map classnames) throws RuntimeCopyException { try { return new StackMapTable(newCp, new Copier(this.constPool, info, newCp).doit()); } catch (BadBytecode e) { throw new RuntimeCopyException...
1
protected <T> boolean checkIColors(T obj1, T obj2) { /** Convert IColor-s from the colors teachpack to java.awt.Color */ if (obj1.getClass().getName().equals("colors.Red")) return obj2.getClass().getName().equals("colors.Red"); if (obj1.getClass().getName().equals("colors.White")) return obj2.getClass().get...
6
public void visitInnerClass(final String name, final String outerName, final String innerName, final int access) { if (innerClasses == null) { innerClasses = new ByteVector(); } ++innerClassesCount; innerClasses.putShort(name == null ? 0 : newClass(name)); innerClasses.putShort(outerName == null ? 0 : n...
4
private void addReference(final int sourcePosition, final int referencePosition) { if (srcAndRefPositions == null) { srcAndRefPositions = new int[6]; } if (referenceCount >= srcAndRefPositions.length) { int[] a = new int[srcAndRefPositions.length + 6]; System.arraycopy(srcAndRefPositions, 0, a, 0, ...
2
public void generarDOT_DesdeArchivo() { FileWriter archivoAutomata = null; PrintWriter pw = null; nombreAutomata = JOptionPane.showInputDialog("Por favor, indique el nombre del archivo DOT que describe al automata"); this.nombreAutomata += ".dot"; try { //archivoAutom...
8
public Model(int col, int row) { this.board = new CellState[col][row]; for (int j = 0; j < row; ++j) { for (int i = 0; i < col; ++i) { this.board[i][j] = CellState.EMPTY; } } // nextPlayer(); }
2
public DefaultHandler(boolean consoleLogging, String fileName) throws FreeColException { this.consoleLogging = consoleLogging; File file = new File(fileName); if (file.exists()) { if (file.isDirectory()) { throw new FreeColException("Log file \"" + fileName ...
7
public boolean handles(HTTPRequest req) { return req.getPath().matches(PATH)&&req.getHost().matches(HOST); }
1
protected void powerUpTimer() { int type = (int) (Math.round(Math.random() * 5)); powerUpList.add(new PowerUp(type)); if (fixedSpeed == false) { ball.increaseSpeed(); } //A chance to create a black hole is 1/6 if (type == 0) { isBlackHole = true;...
2
public void chasePlayer(){ if(abs(this.x - player.getX()) > abs(this.y - player.getY())){ if(player.getX() < this.getX()){ this.dx = -1; if(this.dy > 0){ dy -= .03; } else{ dy += .03; } } if(player.getX() > this.getX()){ this.dx = 1; if(this.dy > 0){ dy -= .03; ...
9
public void setHasVisited(boolean hasVisited) { this.hasVisited = hasVisited; }
0
public int getEndLineNumber() { return endLineNumber; }
0
private void formPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_formPropertyChange if (evt.getPropertyName().equals("LadattuProfiili")) { if (palkanlaskenta.getProfiili() != null) { LadattuProfiili.setText(palkanlaskenta.getProfiili().toString()); }...
5
public void jasmin() { try{ // jasmine uses a ".j" extension by default String name = browseClass() + ".j"; String fileName = parseFileDir(name) + parseFileName(name) + "." + parseFileExt(name); // make sure there is a place to put it if (!parseFileDir(name).equals(""...
5
@Override public void load() { if (vertexLocation != null) { ResourceText txt = ResourceManager.getText(vertexLocation); txt.load(); vertexSource = txt.getText(); } if (fragmentLocation != null) { ResourceText txt = ResourceManager.getText...
6
private void loadHashMap() { // load from a file formatted like this: // #HEX color // e.g #FFFFFF white File colorMap = new File("colormap.txt"); try { BufferedReader in = new BufferedReader(new FileReader(colorMap)); while (in.ready()) { String line = in.readLine(); // make sure it matches the...
5
private void performFileActions() throws Exception { if(!PERFORM_FILE_ACTIONS) return; for(IFile fileAction : fileActions) { if(fileAction == null) break; fileAction.perform(); fileAction.shutdownNow(); } }
3
public boolean isAnagrams(String a, String b) { if (a == null || b == null) { return false; } if (a.isEmpty() || b.isEmpty()) { if (a.isEmpty() && b.isEmpty()) { return true; } else { return false; } } if (a.length()!=b.length()){ return false; } int l=a.length(); for(int i=0;i<l...
9
@Override public void update(GameContainer gc, int d) throws SlickException { for (int x = 0; x < tiles.length; x++){ for (int y = 0; y < tiles[x].length; y++){ if (tiles[x][y] != null) tiles[x][y].update(d); } } }
3
public static List<Command> readList(String pathName) { List<Command> list = new ArrayList<Command>(); ObjectInputStream oin = null; try { File f = new File(pathName); if (f.exists()) { oin = new ObjectInputStream(new BufferedInputStream( new FileInputStream(f))); list = (List<Command>)oin.read...
4
public static String getDynamicStorageLocation () { if (CommandLineSettings.getSettings().getDynamicDir() != null && !CommandLineSettings.getSettings().getDynamicDir().isEmpty()) { return CommandLineSettings.getSettings().getDynamicDir(); } switch (getCurrentOS()) { case WIND...
5
public BigDecimal median_as_BigDecimal() { BigDecimal median = BigDecimal.ZERO; switch (type) { case 1: case 12: BigDecimal[] bd = this.getArray_as_BigDecimal(); median = Stat.median(bd); bd = null; break; case 14: throw new IllegalArgumentException("Complex median value not supported"); defa...
3
private Object executeExpression(Value value, EntityMapping entity, ColumnMapping column, ResultSet records){ Object result_value = null; if(value == null){ return result_value; } if(value instanceof SqlValue){ return executeSql(value,entity,column,records); ...
4
public void visitAddressStoreStmt(final AddressStoreStmt stmt) { if (CodeGenerator.DEBUG) { System.out.println("code for " + stmt); } genPostponed(stmt); final Subroutine sub = stmt.sub(); Assert.isTrue(sub.returnAddress() != null); method.addInstruction(Opcode.opcx_astore, sub.returnAddress()); stac...
1
private void createToolBar(Composite parent) { ToolBar toolbar = new ToolBar (parent, SWT.NONE); String group = null; for (int i = 0; i < tools.length; i++) { Tool tool = tools[i]; if (group != null && !tool.group.equals(group)) { new ToolItem (toolbar, SWT.SEPARATOR); } group = tool.group; Too...
6
@Override public double getDblVal() { String s = getStringVal(); try { Double d = new Double( s ); return d; } catch( NumberFormatException n ) { getXfRec(); if( myxf.isDatePattern() ) { // use it try { String format = myxf.getFormatPattern(); WorkBookHandle.simpledateform...
4
static boolean checkUUIDFormat(String uuid) { boolean result = true; int delimCnt = 0; int delimPos = 0; if (uuid == null) { return false; } for (delimPos = 0; delimPos < uuid.length(); delimPos++) { if (uuid.charAt(delimPos) == '-') { delimCnt++; result = result && (delimP...
9
public static int calcvalue(String token) { int result = 0; if (token.equals("RA")) { return backend.Register.r[15].b; } else if (token.equals("SP")) { return backend.Register.r[14].b; } else if (token.startsWith("R")) ...
5
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton6ActionPerformed {//GEN-HEADEREND:event_jButton6ActionPerformed world.choiceMade("right"); }//GEN-LAST:event_jButton6ActionPerformed
0
public void draw(Graphics g) { for (int i = 1; i < body.size(); i++) { int x = body.get(i).getX(); int y = body.get(i).getY(); g.setColor(Color.GREEN); g.fillRect(x, y, Block.WIDTH, Block.HEIGTH); g.setColor(Color.BLACK); g.drawRect(x, ...
1
public void onEnable() { //Fill our hashmap of material aliases with the ones permitted. PopulateMaterials(); //Load the markets, deliveries and revenue load(); //If we didn't load the markets, make them if(markets == null) { markets = new HashMap<Material, Market>(); for( Material mat : ...
6
public static void main(String[] args) throws FileNotFoundException, JSONException, IOException { CommonParameters commonParams = new CommonParameters(); CommandSubmit submitCommand = new CommandSubmit(); CommandStatus statusCommand = new CommandStatus(); CommandCancel cancelCommand = new CommandCancel(); Com...
5
@Override public boolean onCommand(CommandSender sender, Command cmd, String firstArg, String[] args) { /* * /---- [arena, list, join] * | /---- [arenaName] * | | /---- [create, delete, set, check, regen, reload] * | | | ...
8
public static void writePredictionsToFile(String testFile, String outputFileName, HashMap<Long, HashMap<Long, Double>> ratingPredictions) throws IOException{ FileWriter fileWriter = new FileWriter(outputFileName); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); Scanner scan = new...
7
public Method getSetter(String aname, BaseModelMBean bean, Object resource) throws AttributeNotFoundException, MBeanException, ReflectionException { // Cache may be needed for getters, but it is a really bad idea for setters, this is far // less frequent. Method m=null;//(Method)se...
8
public void setTableSwitchJump(int switchStart, int caseIndex, int jumpTarget) { if (!(0 <= jumpTarget && jumpTarget <= itsCodeBufferTop)) throw new IllegalArgumentException("Bad jump target: "+jumpTarget); if (!(caseIndex >= -1)) throw new ...
9
public String getBlogLabel() { return blogLabel; }
0
private LicenseNumber(String nameIdentifier, int yearOfIssue, int serialNumber, String stringRepresentation){ this.nameIdentifier=nameIdentifier; if(nameIdentifier.isEmpty()) throw new IllegalArgumentException("The name Identifier is null"); Date date = new Date(); Calendar cal = new Grego...
4
final public String TableRow() throws ParseException { String s; final StringBuffer buf = new StringBuffer(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRING: label_3: while (true) { s = jj_consume_token(STRING).image; buf.append(s); s...
7
@Test public void smallBoardWithKingAndQueen() { Map<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(KING.toString(), 1); figureQuantityMap.put(QUEEN.toString(), 1); int dimension = 2; Set<String> boards = prepareBoardsWithKingAndQueen(figureQuant...
5
private void initializeApp() { manager = Manager.getInstance(); for (Disc disc : manager.getDiscs().getDiscs()) { discSelector.addItem(disc.getName()); } currentProfile = manager.getProfiles().get("andersonmaaron"); currentCourse = manager.getCourses().get("G...
1
@Override public void unInvoke() { if(!(affected instanceof MOB)) return; final MOB mob=(MOB)affected; if(canBeUninvoked()) doneTicking=true; super.unInvoke(); if(canBeUninvoked() && (mob!=null)) { final Room R=mob.location(); if((R!=null)&&(!mob.amDead())) { final CMMsg msg=CMClass.get...
8
public GetKeyDialog(JDialog owner, String title, boolean modal) { /** call base class constructor */ setTitle(title); setModal(modal); /** setup pointer to point to itself */ me = this; /** add keyboard event handler */ addKeyListener(...
9
private void movement(Ship[] ship){ //Hier werden die Bewegungen der einzelnen Schiffe durchgeführt. Ship s; //Das derzeitige Schiff Ship t; //Das Ziel von s double movement; //Die nötige Bewegung um den Befehl zu erfüllen double distance; //Der Abstand zwischen s und t for (int i = 0; i < ship....
8
public void visit_fadd(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
1
public int getVersionCode() { return this.versionCode; }
0
@EventHandler(priority = EventPriority.NORMAL) public void onPickupItem(PlayerPickupItemEvent event){ Player player = event.getPlayer(); if(!player.hasPermission("NodeWhitelist.Whitelisted")){ if(!whitelistWaive.isWaived(player)){ if(!Config.GetBoolean("NoneWhitelisted.Restraints.Interact")){ event.setCa...
3
public void serverReceiveMessages() { String input; String inPart1; String inPart2; try { input = inClient.readLine(); if(input != null) { String pattern = "^([A-Z]+:)([a-zA-Z0-9:\\s]*)$"; Pattern p = Pattern.compile(pattern); Matcher m = p.matcher(input); //the communication from the clie...
8
@Override public void setKeyState(int key, boolean state) { byte index = -1; if(key == settings.forwardKey.key) { index = 0; } if(key == settings.backKey.key) { index = 1; } if(key == settings.leftKey.key) { index = 2; } if(key == settings.rightKey.key) { index = 3; } if(k...
7
@Override public void paint ( Graphics gr ) { initDraw(gr); //Clean the Frame. switch(actualRole) { case PreGame: DrawPreGame(gr); break; case Contributor: DrawNumbersToInstantiate(gr); DrawGrid(gr); break; default: if (state == GameState.game) { DrawGrid(gr); } break; ...
3
static void tuneAll(Instrument[] e) { for (Instrument i : e) tune(i); }
1
protected void drawTransitions(Graphics g) { Graphics2D g2 = (Graphics2D) g; Set arrows = arrowToTransitionMap.keySet(); Iterator it = arrows.iterator(); while (it.hasNext()) { CurvedArrow arrow = (CurvedArrow) it.next(); if (arrow.myTransition.isSelected){ arrow.drawHighlight(g2)...
2