text
stringlengths
14
410k
label
int32
0
9
public BackGround(final JFrame frame, final String imageName ){ Container panel = frame.getContentPane(); try { imageOrg = ImageIO.read(this.getClass().getResource("/Image/" + imageName)); image = imageOrg.getScaledInstance(panel.getWidth(), panel.getHeight(), Im...
3
static void llenar(LinkedList<int[]> r, Pieza p, int vAbajo){ int v=vAbajo,x=vAbajo; for(Pieza m=p;m!=null;m=m.piezas[(x+1)%4]){ r.add(new int[]{m.valor,v}); int i=0; if(m.piezas[(v+1)%4]!=null)for(;i<4;i++)if(m.piezas[(v+1)%4].piezas[i]==m)break; x=v; v=(i+1)%4; } v=vAbajo;x=vAbajo; for(Pieza ...
9
private void runStateMachine() { while(!tokenFoundFlag){ if(exitSMFlag) break; switch(nextState){ case 1: // letter letter(); break; case 2: symbol(); break; case 3: number(); break; case 4: otherChar(); break; } } }// end of "runStateMachine"
6
private static void validate(String input) throws Exception { if (input.length() > MAX_LENGTH) throw new Exception("word can be no longer than 30 characters"); Set<Character> set = new HashSet<Character>(); for (int i = 0; i < input.length(); i++) { set.add(input.charAt(i...
4
public CharSequence getCharContent(boolean ignoreEncodingErrors) { return code; }
0
public static boolean isInRange(float num, float max, float min, boolean showError) { final boolean bool = false; if (num > max || num < min) if (showError) { final IllegalArgumentException as = new IllegalArgumentException("The Number Has to be more than " + max + " and less than " + min + "!"); as.print...
3
public void shootAt(Robot paramRobot, Point paramPoint) { Debug.println("shootAt(" + paramPoint + ")"); this.RobotsWereShootingAt.addElement(paramRobot); paramRobot.playSound("Robot-Angry"); if (!this.active) { Point localPoint1 = getPosition().getMapPoint(); localPoint1.translate(1, ...
4
private static void launchLoginPage() { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop() .browse(new URI( "https://www.freesound.org/apiv2/oauth2/logout_and_authorize/?client_id=608002b12fb0074895d5&response_type=code&state=xyz")); } catch (IOException e) { e.printStackTrace...
3
public static void drawPixels(int i, int j, int k, int l, int i1) { if(k < topX) { i1 -= topX - k; k = topX; } if(j < topY) { i -= topY - j; j = topY; } if(k + i1 > bottomX) i1 = bottomX - k; if(j + i > bottomY) i = bottomY - j; int k1 = width - i1; int l1 = k + j * width; for(i...
6
public void setId(int id) throws ErroValidacaoException { if(id >0) { this.id = id; } else { throw new ErroValidacaoException("O id não pode ser menor que 0 !"); } }
1
public static void validateMove() { if (!validMove) { System.out.println("Invalid Move! Try Again"); System.out.println(); } else { moves = moves + 1; points = points + 5; AchievementRatio = points / moves; } }
1
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof BoundaryBoxFilter)) return false; BoundaryBoxFilter other = (BoundaryBoxFilter) o; if (!this.fieldName.equals(other.fieldName) || this.includeLower != other.includeLower || this.incl...
9
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public int checkMouseCollision(Point clickedPoint) { double d0 = points.get(0).getDistanceTo(clickedPoint); if (d0 <= Constants.POINT_RADIUS) { return 0; } double d1 = points.get(1).getDistanceTo(clickedPoint); if (d1 <= Constants.POINT_RADIUS) { return 1; } double d2 = points.get(2).getDistanceTo(c...
4
public void update(double elapsed) { this.elapsed += elapsed; while (this.elapsed > MOVE_TIME_MILLS) { this.elapsed -= MOVE_TIME_MILLS; for (GameElement element : gameElements) { element.colides(schlange); } schlange.move(); } //check if there are c...
8
public void validateEventStructure(String eventName, List<MMTFieldValueHeader> fieldValueElements) throws MMTInitializationException { if (this.getProtoConfig() == null) { throw new MMTInitializationException("Initialization Exception: getProtoConfig() returns null. A valid MMTRemoteProtocolConfig m...
8
public int[] rangeOfBST(TreeNode root) { int []result = {root.val,root.val}; if(root.left !=null){ int []range = rangeOfBST(root.left); if(range[0]<=range[1]&&range[1]<root.val){ result[0]=range[0]; } else { result[0] = 1;re...
6
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (!(value instanceof TreeItem)) { setText(value.toString()); setBackground(isSelected ? _enabledSelectedBackgrou...
9
public void createGlobalItem(GroundItem i) { for (Player p : Server.playerHandler.players){ if(p != null) { Client person = (Client)p; if(person != null){ if(person.playerId != i.getItemController()) { if (!person.getItems().tradeable(i.getItemId()) && person.playerId != i.getItemController()) ...
7
public boolean tienePrevio(){ boolean resp = false; if(previo != null) resp = true; return resp; }
1
@Override public void moveCursor(int x, int y) { if(x < 0) x = 0; if(x >= size().getColumns()) x = size().getColumns() - 1; if(y < 0) y = 0; if(y >= size().getRows()) y = size().getRows() - 1; textPosition.setColumn(x); ...
4
private static int index(char c) { switch (c) { case '*': return 0; case 'S': return 1; case 'I': return 2; case 'V': return 3; case 'X': return 4; case 'L': ...
9
public void paintComponent(Graphics g){ super.paintComponent(g); g.clearRect(0, 0, getWidth(), getWidth()); int height = engine.area.length; /* if(height * cellSize >= this.getHeight()){ height = (int) Math.floor(this.getHeight()/cellSize); }*/ int width = engine.area[0].length; /* if(width * ce...
6
public int getColumnCount() { return 3; }
0
public static void main(String[] args) { Scanner myScan = new Scanner(System.in); System.out.print("Veuillez entrez vos symptomes: "); String descripMaladie = myScan.nextLine().toUpperCase(); String msgDocteur; if (descripMaladie.contains("TOUSSE") && descripMaladie.contains("SANG")) { msgDocteur = "Tube...
8
public boolean hasFlag (Integer id, Variables flag) { if (npcData.containsKey(id + ":flag")) { String[] flags = npcData.get(id + ":flag").split(","); for (Integer i = 0; flags.length > i; i++) { if (flags[i].equals(flag.toString())) return true; ...
3
public String toString() { if (nome != null) return nome.toString(); return id + ""; }
1
public void tick() { try { player.tick(); } catch (InterruptedException e) { e.printStackTrace(); } sun.tick(); wife.idle(); par.tick(); sad.tick(); /*The Bottom Bounding boxes */ //stop1 = new Rectangle(122, 725, 256, 40); stop2 = new Rectangle(350, 440, 256, 10); stop3 = new Rectangle(...
8
private void animate() { if (startGameImage.contains(currentMouseX, currentMouseY)) { animationIsRunning = true; if (levelSelectAnimation != null) { remove(levelSelectAnimation); } if (levelEditorAnimation != null) { remove(levelEditorAnimation); } startGameAnimation = new RingAnimation(sta...
9
public boolean addFrame(BufferedImage im) { if ((im == null) || !started) { return false; } boolean ok = true; try { if (!sizeSet) { // use first frame's size setSize(im.getWid...
7
public int buildAndStartNewPipelineFromGson(GsonNewPipelineRequest request) { LatLong boundingBoxNW = new LatLong(request.NWlat, request.NWlong); LatLong boundingBoxSE = new LatLong(request.SElat, request.SElong); GeoParams geoParams = new GeoParams(request.resolutionX, request.resolutionY, boundingBoxNW, boun...
3
public void pickupItems(int numberOfItems, float maxDistance) throws IOException { int itemsPicked = 0; long startDeadlockCheck = System.currentTimeMillis(); do { float[] itemAgentIdAndDistance = this.getNearestItemToAgentEx(-2); long currentlyElapsedTime = System.curr...
7
public boolean equals(Spire s) { if ((s.getX() == this.x) && (s.getY() == this.y) && (s.getZ() == this.z) && (s.getXs() == this.xs) && (s.getYs() == this.y) && (s.getZs() == this.zs)) { return true; } return false; }
6
public boolean isAnimating() { return animating; }
0
public static List<Word> parseWords(String sentence) { List<Word> words = new ArrayList<>(); String[] strings = sentence.split("\\s+"); for (String string : strings) { words.add(new Word(string)); } return words; }
1
protected void search(String fileName){ startOutput(fileName); while(!cobweb.getUnsearchQueue().isEmpty()){ final WebPage wp = cobweb.peekUnsearchQueue();// 查找列隊 if (!cobweb.isSearched(wp.getUrl())) { try { leavesContentFileWriter.write(CrawlResultFormat.webPageHead(wp)); leavesContent...
3
private void locateNext() { hasNext = true; pos += value.length(); int i = -1; int iOr = lowered.indexOf("or", pos); int iAnd = lowered.indexOf("and", pos); if (iOr != -1 && iAnd != -1) i = iOr < iAnd ? iOr : iAnd; else if (iOr != -1) i = iOr; else if (iAnd != -1) i = iAnd; ...
9
public static TriCubicSpline[] oneDarray(int nP, int mP, int lP, int kP){ if(mP<3 || lP<3 || kP<3)throw new IllegalArgumentException("A minimum of three x three x three data points is needed"); TriCubicSpline[] a = new TriCubicSpline[nP]; for(int i=0; i<nP; i++){ a[i]=TriCubicSpline.ze...
4
public static double NeedlemanWunsch(String mSeqA, String mSeqB) { final int L1 = mSeqA.length(); final int L2 = mSeqB.length(); int[][] matrix = new int[L1 + 1][L2 + 1]; for (int i = 0; i < L1 + 1; i++) matrix[i][0] = -1 * i; for (int j = 0; j < L2 + 1; j++) matrix[0][j] = -1 * j; for (int i = 1; i <...
5
@Before public void setUp() { }
0
public static void printToConsole(String text) { for (String line : text.split("\n")) { log.info(line); } }
1
public void followingItem(Item I) { if(I.container()!=null) I.setContainer(null); final Room R=CMLib.map().roomLocation(I); if(R==null) return; if(R!=lastOwner.location()) lastOwner.location().moveItemTo(I,ItemPossessor.Expire.Never,ItemPossessor.Move.Followers); if((inventory)&&(R.isInhabitant(la...
7
private void AddbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddbtnActionPerformed int Fi = Table.getSelectedRow(); if (Fi < 0) { String Mensaje = "Elija Un Producto Antes de Continuar," + "o elija menos de dos productos"; JOptionPan...
7
private void checkShowWelcomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkShowWelcomeActionPerformed File config = DFAMainWin.getConfigFile(); if(checkShowWelcome.isSelected()) { if(config.exists()) { //delete if(!config.delete()) { ...
5
public String worstQuestion() { if(questionStats.size() > 0) { QuestionStatistic min = Collections.min(questionStats); return min.questionText + ", " + min.correctAnswers + " times."; } return "no statistics found!"; }
1
public String nextCDATA() throws JSONException { char c; int i; StringBuffer sb = new StringBuffer(); for (;;) { c = next(); if (c == 0) { throw syntaxError("Unclosed CDATA"); } sb.append(c); i =...
6
public final void write(DataOutputStream out) throws IOException { _debug.fine("Anmeldelistentelegramm versenden: ", this); out.writeShort(length); out.writeBoolean(delta); out.writeLong(transmitterId); if(objectsToAdd == null) { out.writeShort(0); } else { out.writeShort(objectsToAdd.length); fo...
8
public static void cleanDirectory(final File directory) throws IOException { if (!directory.exists()) { final String message = directory + " does not exist"; throw new IllegalArgumentException(message); } if (!directory.isDirectory()) { final String message =...
6
public Sequence getSubsequence(Nucleotide aStartNucleotide, Nucleotide anEndNucleotide) throws NonConsecutiveNucleotideException { if (!this.containsNucleotide(aStartNucleotide) || !this.containsNucleotide(anEndNucleotide)) { return null; } if(aStartNucleotide.compareTo(anEndNucleotide) == -1 ){ r...
9
public void init(int nplayers, int[] pref) { this.preferences = pref.clone(); this.id = this.getIndex(); this.players = nplayers; this.maxBowls[0] = this.players - this.id; this.maxBowls[1] = this.id + 1; //System.out.println("Player ID: " + this.id); //System.out.println("Max bowls can be seen: Round 0: ...
3
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
6
@Override public void Insertar(Object value) { Session session = null; try { Ejecutivo ejecutivo = (Ejecutivo) value; session = NewHibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.save(ejecutivo); ...
2
public boolean addSkillXP(int amount, int skill){ if (c.expLock) { return false; } if (amount+c.playerXP[skill] < 0 || c.playerXP[skill] > 200000000) { if(c.playerXP[skill] > 200000000) { c.playerXP[skill] = 200000000; } return false; } amount *= Config.SERVER_EXP_BONUS; int oldLevel = getLe...
8
public static boolean pointIsWithinSectorAngleBoundries(Point2D.Double p, Point2D.Double origo, double angle1, double angle2) { // System.out.println("Point: "+p.getX()+"-"+p.getY()); // System.out.println("Heuristic origo: "+origo.getX()+"-"+origo.getY()); // System.out.println("Vector: "+angle1+ "===== sector:...
5
@Test public void EnsureLeadingAndTrailingSlashIsRemoved() { String path = "/x/y/"; String newpath = Path.trimSlashes(path); assertEquals("x/y", newpath); }
0
public int getCoordonneeY() { return y; }
0
public void write(Writer out) throws IOException { out.write(HEADER); Object[] sumval = {result, totalTime, numTestTotal, numTestPasses, numTestFailures, numCommandPasses, numCommandFailures, ...
7
public java.io.Serializable readAutomaton(Node parent, Document document) { Set locatedStates = new java.util.HashSet(); Automaton root = createEmptyAutomaton(document); if(parent == null) return root; readBlocks(parent, root, locatedStates, document); // Read the states and transitions. readTransitio...
1
private static void input(String[] args) throws Exception { // argument checking if (args.length > 0) { if (args[0].equals("-h")) { System.out.println("**HELP MENU**"); System.out.println("tf2mapgen <filename>"); System.out.println("output is s...
5
public boolean hasCoupPossible() { for (Case caseDame : tablier.getAllCase()) { if((!tablier.isDameDansCaseBarre(joueurEnCour) && caseDame.getCouleurDame() == joueurEnCour) || caseDame.isCaseBarre()) for (DeSixFaces de : deSixFaces) { if(!de.isUtilise()) if(isCoupPossible(caseDame,tablier.getCa...
7
@Override public synchronized void writeCreditTransactionToFile(Transaction transaction) { if (creditCounter % BATCH_SIZE == 0 && creditCounter > 0) { String newCreditFileName = this.reportDao.getCurrentFileName(TransactionType.CREDIT.toString(), creditFileName); if (!newCreditFileName.equalsIgnoreCase(c...
5
public static void call(final String data) throws Exception { // delimited by a comma // text qualified by double quotes // ignore first record final Parser pzparser = DefaultParserFactory.getInstance().newDelimitedParser(new File(data), ',', '\"'); final DataSet ds = pzparser.pa...
4
@Override public void run(String arg) { int numImages = WindowManager.getImageCount(); if( numImages == 0 ) { IJ.error( "Geodesic reconstruction 3D", "At least one image needs to be open to run Geodesic reconstruction in 3D" ); return; } String[] names = new String[ numImages ]; ...
9
public static void castVote(VoteCast vote){ if(vote == VoteCast.A) A+=1; else if(vote == VoteCast.B) B+=1; else if(vote == VoteCast.R) R+=1; updatePlayerReadout(); }
3
private void btnExcelExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcelExportActionPerformed String input = Utils.showFileChooser("Opslaan", "Rooster"); if (!input.isEmpty()) { boolean inverted = Utils.promptQuestion("Wilt u de tabel omgedraaid of precies zoals...
2
public void personDetailsForm() { super.personDetailsForm(); vatNumber = null; contactName = null; // Contact name if (!contactNameField.getText().equals("")) { contactName = contactNameField.getText(); contactNameLabel.setForeground(Color.black); } else { errorMessage = errorMessage + "Contact...
9
public void removeTask(int taskEntID) { Task toRemove = null; synchronized (tasks) { for (Task t : tasks) { if (t.getEntityID() == taskEntID) { System.out.println("TASK TO REMOVE FOUND"); toRemove = t; } ...
3
public static JSONObject toJSONObject(String string) throws JSONException { JSONObject o = new JSONObject(); XMLTokener x = new XMLTokener(string); while (x.more() && x.skipPast("<")) { parse(x, o, null); } return o; }
2
public Hashtable<String, K> getCodes() { return codes; }
0
@Override public void render() { double[] pos; float[] color; double size; double angle; int numVerts_ = 8; GL11.glBegin(GL11.GL_TRIANGLES); for(int i = 0; i < MAX_PARTICLES; i++) { color = getCRule(cID_[i]).getColor(r_[i], g_[i], b_[i], a_[i], age_[i], props_[i]); size = getSRule(sID_[i]).getSi...
4
private void sendPackage(String type, String... item) { if ( (manager.getCurrentStage() != null && !manager.isStageItemsEmpty()) || type.equals(OVERLAY) ){ //printStage(); IsaacGamePackage isaacPackage = manager.createGamePackage(type, item); try { if (isGameActive()) { queue.put(isaacPackage); // b...
6
public static void minmaxBonus(Manager[] a, Pair<? super Manager> result) { if (a == null || a.length == 0) return; Manager min = a[0]; Manager max = a[0]; for (int i = 1; i < a.length; i++) { if (min.getBonus() > a[i].getBonus()) min = a[i]; if (max.getBonus() < a[i]....
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NucleotideInteraction other = (NucleotideInteraction) obj; if (firstNucleotide == null) { if (other.firstNucleotide != null) return false;...
9
@Override public boolean evaluate(RuleContext ruleContext) { BigDecimal lhs = new BigDecimal(mValues.get(0).asString(ruleContext)); BigDecimal lower = new BigDecimal(mValues.get(1).asString(ruleContext)); BigDecimal upper = new BigDecimal(mValues.get(2).asString(ruleContext)); boolean result = fals...
8
protected void renameProfile() { boolean doit = true; for(int i=profiles.size()-1; i>=0; i--) { Profile p = profiles.get(i); if(p.name.equals(txtProfile.getText())){ doit = false; //if we find a duplicate name, don't do it! } } if(doit){ selProfile.name = txtProfile.getText(); profileListMdl....
5
@RequestMapping("/listarStock") public ModelAndView listarStock() { Stock stock = Stock.getInstance(); Map<String, Integer> mapStock = stock.obtenerStock(); Set<String> setStock = mapStock.keySet(); List<Producto> productList = new ArrayList<Producto>(); for (Iterator<String> iterator = setStock....
1
private JSONWriter append(String s) throws JSONException { if (s == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write(','); ...
7
public ArrayList<ArrayList<Integer>> subsetsWithDup(int[] num) { ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>(); if (num == null) return res; if (num.length == 0) { res.add(new ArrayList<Integer>()); return res; } Arrays.sort(num); for (int ...
9
private BigInteger[] getPrimesParallel(int keyBitSize) { GenPrimeThread[] primeThreads = new GenPrimeThread[cores]; BigInteger[] primes = new BigInteger[cores]; BigInteger[] retPrime = new BigInteger[2]; for (int i = 0; i < cores; i++) { primeThreads[i] = new GenPrimeThread...
9
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed if (!txtCaminhoBanco.getText().isEmpty() && (txtCaminhoBanco.getText().contains(":/") || txtCaminhoBanco.getText().contains(":\\"))) { JTextField pwd = new JPasswordField(10); JLabe...
5
private double classificationConverter(String classification) { double convertedClassification; if (classification.equals("Definitive")) convertedClassification = 1.0; else if (classification.equals("Dependent")) convertedClassification = 2.0/3.0; else if (cla...
7
public static int GetCurrentSecondHighActivatedNodeAL(){ //功能: //得到当前激活强度次高的节点的激活强度 int low=0; int GraphSize=CognitiveGraph.size(); Vector<Integer> useforsort = new Vector<Integer>(); for(int i=0;i<GraphSize;i++){ int ListSize=CognitiveGraph.get(i).ObjOrAttri.size(); for(int ii=0;ii<ListSize;ii++){ ...
7
public static ScoringStyle parseStyle(String styleString) { if (styleString.contains("PERCENT_SCORE")) { return PERCENT_SCORE; } else if (styleString.contains("BULLET_DAMAGE")) { return BULLET_DAMAGE; } else if (styleString.contains("SURVIVAL_FIRSTS")) { return SURVIVAL_FIRSTS;...
6
private StringBuilder hexToString(StringBuilder hh) { // make sure we have a valid hex value to convert to string. // can't decrypt an empty string. if (hh != null && hh.length() == 0){ return new StringBuilder(); } StringBuilder sb; // special case, test fo...
8
public ReaderConfig(ResourceBundle resourceBundle) { Enumeration<String> fileContext = resourceBundle.getKeys(); while (fileContext.hasMoreElements()) { String element = (String) fileContext.nextElement(); if ("storiesNumber".equals(element)) { storiesNumber = Integer.valueOf(resourceBundle .getStri...
6
public void moveleft(){ switch (polygonPaint) { case 0: line.moveLeft(); repaint(); break; case 1: curv.moveLeft(); repaint(...
7
@Override public T askChoice(boolean cancel) { String playerName = control.getPlayer().getName(); System.out.println(playerName + ", " + promptMessage); int choice = -1; int cancelChoiceNb = control.getChoices().size() + 1; int maxSize; if (cancel) { maxSize = cancelChoiceNb; } else { maxSize = co...
8
public void processEvent(Event event) { if (event.getType() == Event.COMPLETION_EVENT) { System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle()); return; } System.out.println(_className + ".processEvent: Received Login Response.....
8
@Test void testA() { if (true) throw new RuntimeException("This test always failed"); }
1
public void generateNodes(int number) { for(int i=0;i<number;i++) { Node n = new Node(i); this.nodes.add(n); } }
1
public int [][] loadTrainData (String fileName) { System.out.println ("Load Train Data Start!"); wordMapping = new HashMap <String,Integer> (); BufferedReader reader = null; int trainData [][] = null; try { File file = new File (fileName); reade...
7
public static void main (String [] args) { double salarioatual,salarionovo; char salario ; Scanner teclado = new Scanner(System.in); System.out.print("Informe o seu salario para saber qual foi o aumento:"); salarioatual = teclado.nextInt(); if (salarioatual >0 && salarioatual <=1499){ salarionovo = ...
9
public MenuItem getDisplayMenu() { if (displayMenu == null) { displayMenu = new Menu("Display"); // Create listener for Display menu items. ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { MenuItem item = (MenuItem) e.getSource(); if ("Error".equals(...
5
@Override public int hashCode() { int hash = 0; hash += (idPeriferico != null ? idPeriferico.hashCode() : 0); return hash; }
1
private void unpackBigPacket(DemultiplexerStreaminformations stream) throws InterruptedException { // Nutzdatenpakete (das können mehrere sein) und der Paketindex(des großen Pakets) stehen nun zur Verfügung. // Genau an dieser Stelle greift der Thread auf eine Queue zu, die ihn schlafen legt, wenn KEIN Paket vorha...
8
public static String right(String str, int len) { if (str == null) { return null; } if (len < 0) { return EMPTY; } if (str.length() <= len) { return str; } return str.substring(str.length() - len); }
3
private static void setIsPrime() { for(int i = 2; i < isPrime.length; i++) isPrime[i] = true; for(int i = 2; i < isPrime.length; i++) if( isPrime[i] ) for(int j = 2; j*i < isPrime.length; j++) isPrime[i*j] = false; }
4
public void render(){ //BS bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } //END BS Graphics g = bs.getDrawGraphics(); if(gameState == GameState.MENU) g.drawImage(menuImage, 0, 0, getWidth(), getHeight(), null); else g.drawImage(level.getDojoImage(), 0, 0, getWidth...
7
private void process(Transferable t) { final DataFlavor df = DataFlavor.stringFlavor; if (t.isDataFlavorSupported(df)) { try { BufferedReader r = new BufferedReader(df.getReaderForText(t)); String line; while ((line = r.readLine()) != null) { ...
4
public static void main(String[] args) { TestAtom A = new TestAtom(); Movable player = new Movable(); ArrayList<VerbSignature> signatures = A.getVerbs(player).verbs; for(VerbSignature v : signatures) { System.out.println("Verb: "+v.verbName); for(VerbParameter p : v.parameters) { System.out....
2