text
stringlengths
14
410k
label
int32
0
9
protected ServerSocket bindConnection(final InetAddress inetAddress, final int suggestedPort) throws IOException { for (final InetAddress localInetAddress : this.configurationFacade .getOutgoingSourceAddresses()) { if (localInetAddress.equals(inetAddress)) { final ServerSocket serverSocket = new Server...
4
public void generateNodes(boolean allowDiagonals) { for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[0].length; j++) { grid[i][j] = new Node(new Vertex(new Vector3f(i * TILE_SIZE, 0, j * TILE_SIZE)), heuristic, true); } } addManhattanNeig...
3
public String getTypeSignature() { switch (typecode) { case TC_LONG: return "J"; case TC_FLOAT: return "F"; case TC_DOUBLE: return "D"; default: return "?"; } }
3
public double[] standardizedPersonMinima(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.standardizedPersonMinima; }
2
public double getDouble(int index) throws JSONException { Object object = this.get(index); try { return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object); } catch (Exception e) { throw new JSONException("J...
2
public String getDescription() { return description; }
0
public void update(long timePassed){ if(weapon.roundDenom == 0){ empty(); }else{ if(reloadTimePassed >= 0){ reloadTimePassed += timePassed; } if((int)nextFullIcon.X == icons.length - 1 && (int)nextFullIcon.Y == icons[0].length &&reloadTimeP...
9
public DwarvenWarAxe() { this.name = Constants.DAWNGUARD_WAR_AXE; this.attackScore = 11; this.attackSpeed = 14; this.money = 1600; }
0
private static boolean addNeighbors(Cluster cluster,Cluster cluster2){ boolean merge=false; if(cluster==null || cluster2==null){ return false; } try{ for(int index=0;index<cluster2.getNumInstances();++index){ Instance p=cluster2.getInstance(index); if(p.isKey() && cluster.contains(p)){ merge=...
9
public void postMessage(String userEmail, String messageContent) { initConnection(); String preparedString = null; PreparedStatement preparedQuery = null; try { //Prepare Statement preparedString = "INSERT INTO messages (`timestamp`, user, content) VALUES (?, ?, ?);"; preparedQuery = (...
2
public ArrayList<Conditional> getAnswer() { ArrayList<Conditional> Answers = new ArrayList(); for(Conditional c: wm) { if(c.getFact().isAnswer() && !c.getNotFlag()) { if (!Answers.contains(c)) { Answers.add(c); } ...
4
@Override public void mouseClicked(MouseEvent e) { int x = e.getX(); int y = e.getY(); //TODO -- real coords if( (x >= 845 && x <= 1100) && (y >= 845 && y <= 1000) ){ layout.cl.show(panelContainer, "2"); } }
4
public String toString() { StringBuffer s = new StringBuffer(); for (int i = 0; i < 8; i++) { s.append("[B" + (i + 1) + "]"); for (Carte c : this.bases.get(i)) { s.append(" " + c.toString()); } s.append("\n"); } s.append(super.toString()); s.append("[Pot] "); if (this.pot.size() == 0) ...
4
public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { //Presiono flecha izquierda direccion = 3; } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { //Presiono flecha derecha direccion = 4; } if (e.getKeyCode() == KeyEvent.VK_P) { ...
9
public int maxLocals() { if (code != null) { return code.maxLocals(); } return 0; }
1
public void render(GameContainer container, Graphics g) throws SlickException { if (player1.absolutex - viewW/2 > 0 && player1.absolutex + viewW/2 < mapw) { camerax = player1.absolutex - viewW/2; } if (player1.absolutey - viewH/2 > 0 && player1.absolutey + viewH/2 < maph...
7
public static List<Prop> parsePropList(String value){ String[] props = value.substring(0,value.length()-1).substring(1).split(","); List valuesList = new ArrayList(); for(String propStr : props){ String[] vs = propStr.split(":"); Prop prop = new Prop(); if(vs....
4
private void rotate() { if (startingArrowStrand[0] != null) setStartingArrowPosition(startingArrowStrand[0], 0); if (startingArrowStrand[1] != null) setStartingArrowPosition(startingArrowStrand[1], 2); if (startingArrowStrand[2] != null) setStartingArrowPosition(startingArrowStrand[2], 4); if (startingArrowStra...
4
protected void paintComponent(Graphics g) { if (thumbnail == null) { loadImage(); } if (thumbnail != null) { int x = getWidth()/2 - thumbnail.getIconWidth()/2; int y = getHeight()/2 - thumbnail.getIconHeight()/2; if (y < 0) { y = 0...
4
public void run() { try { StringBuffer colClause = new StringBuffer(); for (String col:t.prdFKCols) { System.out.format("FK %s.%s.%s\n",t.schema,t.name,col); if (colClause.length() != 0) colClause.append(","); ...
9
@Override public void keyPressed(KeyEvent e) { switch(e.getKeyCode()){ case KeyEvent.VK_ESCAPE ://escape key ends the script running = false; break; default : break; } }
1
public void setNextGlied(SchlangenGlied glied) { if (nextGlied != null) { nextGlied.removePreviousGlied(); } nextGlied = glied; if (glied.getPreviousGlied() != this) { glied.setPreviousGlied(this); } }
2
@ConstructorAnnotation public AnnotatedBean() { }
0
public static ChessTimer createTimer(TimerTypes timerType, RunnableOfT<Boolean> timeElapsedCallback, long incrementAmount, long startTime, boolean isBlackTeamTimer) { switch (timerType) { case NO_TIMER: return new NoTimer(); case BRONSTEIN_DELAY: return new BronsteinDelayTimer(timeElapsedCallback, inc...
7
public String getName() {return "Vanilla";}
0
public boolean equals(Object obj){ // We first check if we have a correct object to compare if (obj == null || ! (obj instanceof Environment)) return false; Environment env = (Environment) obj; // When do we consider that two different environments are equal? // When both environments have the same n...
6
public void addMember(Actor member, Stage stage) { if(members.size() < maxPartySize && !members.contains(member)) { members.add(member); member.setInParty(1); } else if(members.size() >= maxPartySize) { Textbox text = new PlainText(false, 3f, false); text.setSource(members.get(0)); text.buildText("Pa...
3
public static void setPartitionPaddingMode(int i) { if (i >= 0 && i <= 2) { partition_padding_mode = i; } }
2
private CarListJsonConverter() { }
0
public void handleNonGeometricAttributes(String resType, String featureAttribute, String featureName, String featureClass) throws UnsupportedEncodingException, FileNotFoundException { try { if (!featureAttribute.equals(ignoreStr)) { String encodingType = UR...
6
private void computeListCommand(String message) { // Aktualisiere liste der Mails checkMailFiles(); // Auf Argumente ueberpruefen String[] cmd = message.split(" "); if (cmd.length > 1) { int n = Integer.parseInt(cmd[1]); long size = getMailSize(n); String response = "+OK " + n + " " + size; try { ...
5
public static boolean updateEventUserStatus(int eventId, int userId, int statusCode) throws HibernateException { boolean isUpdateEventUserStatusSuccessful = false; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); // updat...
4
public static String filterStr(String str) { StringBuilder sb = new StringBuilder(); int len = str.length(); char pre_char = '`';//不等于split_char的字符 for (int i = 0; i < len; i++) { boolean find = false; char cur_char = str.charAt(i); for (char t : token...
8
public KeyPair generate() { if (p == null) { BigInteger[] params = new RFC2631(m, l, rnd).generateParameters(); seed = params[RFC2631.DH_PARAMS_SEED]; counter = params[RFC2631.DH_PARAMS_COUNTER]; q = params[RFC2631.DH_PARAMS_Q]; p = params[RFC2631.DH_PARAMS_P]; ...
7
public void renderSheet(int xp, int yp, SpriteSheet sheet, boolean fixed) { // gonna render a sprite if (fixed) { xp -= xOffset; yp -= yOffset; } for (int y = 0; y < sheet.SPRITE_HEIGHT; y++) { int ya = y + yp; for (int x = 0; x < sheet.SPRITE_WIDTH; x++) { int xa = x + xp; if (xa < 0 || xa ...
7
public void display() { SwingUtilities.invokeLater(() -> setVisible(true)); }
0
protected void addToken(int length, byte id) { if(id >= Token.INTERNAL_FIRST && id <= Token.INTERNAL_LAST) throw new InternalError("Invalid id: " + id); if(length == 0 && id != Token.END) return; if(firstToken == null) { firstToken = new Token(length,id); lastToken = firstToken; } else if(las...
7
public static String[][] sort(String[][] clientArray, int column, boolean ascending) { String[] min, merke; int pos, posMin; // Sortieren und Vertauschen for (int i = 0; i < clientArray.length; i++) { // Kleinste Position ab i suchen posMin = i; min = clientArray[i]; for (pos = i + 1; pos < client...
5
public void printValues(int direction, int rowmin, int rowmax, int colmin, int colmax) { if (direction == 0) // Going north, we stick to the column and decrease the row for (int i = rowmax-1; i >= rowmin; i--) System.out.print(m[i][colmin] + " "); else if (direction == 2) // Going south, we sti...
8
public static int extendedSimpleAdd(int a, int b) { if (a > 0 && b > 0) { return simpleAdd(a, b); } if (a > 0 && b < 0) { return simpleSubtract(a, -b); } if (a < 0 && b > 0) { return simpleSubtract(b, -a); } return -simpleAdd(-a, -b); }
6
private void init (int ops) { zinterest = ops; int interest_ = 0; if ((ops & ZMQ.ZMQ_POLLIN) > 0) { interest_ |= SelectionKey.OP_READ ; } if ((ops & ZMQ.ZMQ_POLLOUT) > 0) { if (s != null) // ZMQ Socket get readiness from the mailbox inter...
3
public static void insertCsvFileData(String location, Set<Flight> flightData) throws NewCustomException { if (location != null && flightData.size() != 0) { Location arrLoc = getLocation(location.substring(0, 3)); Location depLoc = getLocation(location.substring(3)); if (arrLoc == null) { arrLoc = set...
6
private static LogLevel stringToLevel(final String levelStr) { if ("trace".equalsIgnoreCase(levelStr)) { return LogLevel.TRACE; } if ("verbose".equalsIgnoreCase(levelStr)) { return LogLevel.TRACE; } if ("debug".equalsIgnoreCase(levelStr)) { ret...
6
@Test public void testConcurrencyExperiment2() { final int clientThreadCount = 5; int count = 0; for (int i = 0; i < mServerCount; i++) { try { mDhtClientArray[i].purge(); } catch (RemoteException e) { e.printStackTrace(); ...
8
private void saveChanges() { // Iterate over nodes in LinkedList for (NodeDisplayGroup node : nodes) { MacAddressDisplay macs[] = node.getMacs(); // Process each mac address for the node for (int i = 0; i < macs.length; i++) { if (macs[i] != null) { String macAddress = new String(""); JTe...
7
public Point(int x, int y, int value) { this.x = x; this.y = y; this.value = value; }
0
private Comic prepareModel() { File[] comicFileName = selectedDir.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().equals("comic.xml"); } }); if (comicFileName.length == 1) { try { final Comic from = (Comic) (XmlUnmarshaller.startUnmarshal...
4
public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo info) throws ResourceException { if (log.isDebugEnabled()) { log.debug("matchManagedConnections, connectionSet=" + connectionSet + ", subject=" + subject + ", fsInfo=" + info); ...
8
static public int longLength (long value, boolean optimizePositive) { if (!optimizePositive) value = (value << 1) ^ (value >> 63); if (value >>> 7 == 0) return 1; if (value >>> 14 == 0) return 2; if (value >>> 21 == 0) return 3; if (value >>> 28 == 0) return 4; if (value >>> 35 == 0) return 5; if (value >...
9
public static NamiCredentials getCredentialsFromClassname(String className, String username) throws CredentialsInitiationException { String fullClassname = "nami.connector.credentials." + className; try { Class<? extends NamiCredentials> credClass; credClass = Class.f...
8
public static List<DiffPair> convert(String gitDiffOutput) { if (gitDiffOutput == null || "".equals(gitDiffOutput)) { return emptyList(); } ArrayList<DiffPair> dps = new ArrayList<DiffPair>(); String gitDiffOutputChangeable = gitDiffOutput; boolean stop = false; while (true) { Matcher matchNewDi...
9
public int maxPathNotRoot(treeNode curRoot) { this.running_time_NotRoot++; if (curRoot == null) return 0; if (curRoot.leftLeaf == null && curRoot.rightLeaf == null) return curRoot.value; int leftMax = maxPathNotRoot(curRoot.leftLeaf); int rightMax = maxPathNotRoot(curRoot.rightLeaf); return (leftM...
4
protected XVar getNonLocal(XTree tree, String name, XVarAccess access) { XScope scope = this; XVar var; while (scope != null) { if (access == XVarAccess.NONE || !(scope instanceof XClassScope)) { var = scope.locals.get(name); if (var != null) { return var; } } if (scope == base) brea...
8
public int compare(File f1,File f2){ String s1=""; String s2=""; if((f1.toString().lastIndexOf("\\") >=0)) s1 = f1.toString().substring(f1.toString().lastIndexOf("\\")+1); if((f1.toString().lastIndexOf("/") >=0)) s1 = f1.toString().substring(f1.toString().lastIndexOf("/")+1); if(f2.toString().lastIndexO...
6
public ArrayList<Metadonnee> getListeMetadonnees() { return listeMetadonnees; }
0
public static TestRunInfo getTestRunInfo(HierarchicalConfiguration testRunData) { TestRunInfo testRunInfo = null; if (testRunData != null) { testRunInfo = new TestRunInfo(); testRunInfo.setId(testRunData.getLong(ID_TAG)); testRunInfo.setName(testRunData.getString(NAME_TAG)); ...
1
private TrieEntry<K, V> addEntry(TrieEntry<K, V> toAdd, int keyLength) { TrieEntry<K, V> current = root.left; TrieEntry<K, V> path = root; while(true) { if(current.bitIndex >= toAdd.bitIndex || current.bitIndex <= path.bitIndex) { toAdd.predecessor = toAdd; ...
9
private static void readEdgeMega(String filename, boolean directed, boolean symmetric) throws IOException { InputStream in = new BufferedInputStream(new FileInputStream(filename)); byte[] buffer = new byte[8]; boolean end =false; int edges = 0; int olde1 = -1; IntArray list = new IntArray(1024); while (!end) {...
9
protected Object computeNumber(Integer left, String op, Integer right) { int a = left.intValue(); int b = right.intValue(); if ("+".equals(op)) { return a + b; } else if ("-".equals(op)) { return a - b; } else if ("*".equals(op)) { return a * b; } else if ("/".equals(op)) { return a / b; } els...
8
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); Produto produto; try { produto = em.getReference(Produto.class,...
9
private Charge2D calcPoint(double x, double y) { Vector2D ep=new Vector2D(0,0); Vector2D currentPos=new Vector2D(x, y); double charge; double potentialSum=0;; for (int i=0;i<_charges.length;i++) { Vector2D v=new Vector2D(_charges[i].getVector().getX(),_charges[i].getVector().getY()); Vector2D trans=v...
7
public void createMap(String file) { BufferedReader fin, in; file = "Tilemaps/" + file; try { fin=new BufferedReader(new FileReader(file)); for(int i=0; i<currentArea.length; i++) for(int j=0; j<currentArea[0].length; j++) currentArea[i][j]=Integer.parseInt(fin.readLine()); } catch(Except...
3
@Test public void test_loadArrayFromFile() { String filePath = "test.txt"; // creating list with specified amount of random numbers List<Integer> list = appUtil.getRandomNumbers(10, 10); appUtil.saveArrayToFile(filePath, list); // testing content of file List<Integ...
1
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { final String path = request.getPathInfo(); String ssid = request.getSession().getId(); response.setContentType("text/html;charset=utf-8"); response...
4
@Override public String toString() { String string = " connected to "; for (AssociationEnhanced as : associations) string += as.getStakeholder().getName() + " p=" + as.getProbability() + " - "; return getName() + " coeff.=" + coefficient + string.substring(0, string.length() - 3); }
1
public ReplaceIns(SootMethod method, Map<Type, Set<Unit>> map, Map<Local, Set<Unit>> saveToBuf) { // TODO Auto-generated method stub m= method; b = m.getActiveBody(); c = m.getDeclaringClass(); getUtilClasses(); Unit unit = getAppCntxtInsPt(); getBufferObj(unit); // addAppContext(unit); Set<...
9
@Override public Object getValueAt(int rowIndex, int columnIndex) { Client client = clients.get(rowIndex); switch (columnIndex){ case 0:return client.getIdClient(); case 1:return client.getNom(); case 2:return client.getPrenom(); case 3:return client.g...
5
public boolean setTurnCount(int count) { boolean test = false; if (test || m_test) { System.out.println("Game :: setTurnCount() BEGIN"); } m_turnCount = count; if (test || m_test) { System.out.println("Game :: setTurnCount() END"); } ...
4
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Piece other = (Piece) obj; if (color == null) { if (other.color != null) { return false; } } else if (!...
7
@Test public void superDuperTest() throws Exception { System.out.println("\nTESTISUJEMO TEST PRIMJER: " + fileName); String output = null; try { output = getAnalyzerOutputFromFile("res/examples/seman-in-extra/" + fileName + ".in"); } catch (Exception e) { System.out.println("------------"); System.out...
5
public boolean peutSupprimer(Utilisateur utilisateur) { return ( utilisateur != null && ( utilisateur.getRole().getValeur() >= Role.Administrateur.getValeur() || ( utilisateur.getRole().getValeur() >= Role.Moderateur.getValeur() ...
5
public void render(float posX, float posY, int x, int y, World w, boolean selected) { if(volume > fluid.getMaxVolume()) volume = fluid.getMaxVolume(); if(getBlockName().equals(fluid.getName()+"_All") || volume == Integer.MAX_VALUE) { w.setBlock(x, y, fluidName+"_"+flu...
9
public void setClientID(String clientID) { this.clientID = clientID; }
0
private String getCommandBySuperAlias(ChunkyCommand command, String commandString) { for (Map.Entry<String, ChunkyCommand> superAlias : superAliases.entrySet()) { if (commandString.toLowerCase().startsWith(superAlias.getKey())) { command = superAlias.getValue(); retur...
2
public static void checkArgs(String[] args) { if (args.length != 3) { System.err.print("Illegal number of arguments! "); System.err.println("usage: <integer: maze height> <integer: maze width>" + " <output file name>"); System.exit(1); } else { Scanner checker = new Scanner(args[0] + " " + a...
4
protected void doVoice(boolean on) { String nicks = "", modes = ""; int count = 0; if (on) modes = "+"; else modes = "-"; for (int i = 0; i < players2.numPlayers(); i++) { try { if (!players2.isDead(i)) { nicks += players2.get(i) + " "; modes += "v"; count++; if (count % 4 =...
7
private void supportChildren(Bundle resources) { int survivingChildren = 0; for (Person child:family.children) if (child.alive) survivingChildren++; Bundle portion = resources.over(survivingChildren); for (Person child:family.children){ if (child.alive){ child.income.insert(portion); if(child.r...
7
private void truncateEntity(T bean) { // deletes every key in the MDR at the moment // can't iterate and delete in one go for concurrency reasons Set<TKey<?, ?>> keysToDelete = new LinkedHashSet<>(); keysToDelete.addAll(bean.getAvailableKeys()); while (!(keysToDelete.isEmpty())) ...
5
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
@Override public boolean doAction(String choice) { switch (choice) { case "P": // Move Player Plane Crash Site MapControl.movePlayer(MapControl.PLANE_CRASH_LOCATION); break; case "T": //Move Player to the Tree line MapControl.movePlayer...
9
private void fillOptionList(Map<String, Object[]> optionMap) { optionsList = new ConcurrentHashMap<>(); for (String key : optionMap.keySet()) { Object[] value = optionMap.get(key); if (value[0].equals(false)) { continue; } switch (key = key.replace("force", "")) { case "onetop": optionsLi...
8
public static void setBreedingAge(int newBREEDING_AGE) { BREEDING_AGE = newBREEDING_AGE; }
0
private void openFilePane() { JFileChooser fileChooser = new JFileChooser(); fileChooser.addChoosableFileFilter( new javax.swing.filechooser.FileFilter() { public boolean accept(File f) { if( f.isDirectory() ) return true; String ext = getExtension(f ); if( ext != null ) { if(...
9
@Override public void paint(Graphics g) { int w = getWidth(); int h = getHeight(); g.setColor(BG_COLOR); g.fillRect(0, 0, w, h); { int l_x = w-3*LOGO_SIZE/2; int l_y = h-LOGO_SIZE; int l_w = LOGO_SIZE * 2; int l_h = l_w; g.drawImage(logo, l_x, l_y, l_w, l_h, null); } int startY = TO...
7
private String fileToString(File file) { // Stores the contents of the file String fullFile = ""; // Creates fullFile String try { Scanner in = new Scanner(file); while (in.hasNextLine()) { fullFile += in.nextLine() + "\n"; } ...
2
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 void chainMethodIdentifier(Identifier chainIdent) { String name = chainIdent.getName(); String typeSig = chainIdent.getType(); for (Iterator i = methodIdents.iterator(); i.hasNext();) { Identifier ident = (Identifier) i.next(); if (ident.getName().equals(name) && ident.getType().equals(typeSig)) ...
3
private boolean projectiveInterval(DependencyStructure parse, DependencyNode left, DependencyNode right) throws MaltChainedException { final int l = swapArray.get(left.getIndex()); final int r = swapArray.get(right.getIndex()); DependencyNode node = null; if (l > r) { return false; } else { for (int i =...
7
public boolean needCacheOperation() { return (cacheDefinition != null || cacheDeleteDefinitions != null || versionUpdateDefinitions != null); }
2
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 static UserDB checkIfLegit(String username, String password){ Statement stmt=null; String searchQuery="SELECT * FROM users WHERE username='"+username+"' AND password='"+password+"'"; try{ dbManager=DBManager.checkInstance(); con=dbManager.getFreeConnection(); stmt=con.createStatement(); rs=s...
9
private OperatingSystem(Manufacturer manufacturer, OperatingSystem parent, int versionId, String name, String[] aliases, String[] exclude, DeviceType deviceType, String versionRegexString) { this.manufacturer = manufacturer; this.parent = parent; this.children = new ArrayList<OperatingSystem>(); // combine m...
2
private Node insert(Node h, Key key, Value value, int ht) { int j; Entry t = new Entry(key, value, null); // external node if (ht == 0) { for (j = 0; j < h.m; j++) { if (less(key, h.children[j].key)) break; } } // internal node else { for (j = 0; j < h.m; j++) { if ((j + 1 == h.m) ...
9
private void setupVault() { //Check for vault first if(getServer().getPluginManager().getPlugin("Vault") == null) { logger.info(String.format("[ButtonsPlus] - No Vault found!, switching to xp mode...", getDescription().getName())); if(Settings.econmode.equalsIgnoreCase("money")) { Settings.econmode = "xp"...
4
private static final int rank (long[][] mat) { int r = 0; for (int i = 0; i < mat.length; i++) if (mat[i][i] != 0) r++; return r; }
2
public void resetBoard(){ for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { m_Pieces[i][j] = NONE_PIECE; } } m_Pieces[3][3]= WHITE_PIECE; m_Pieces[4][4]= WHITE_PIECE; m_Pieces[3][4]= BLACK_PIE...
5
@EventHandler public void OnBlockBreak(BlockBreakEvent e){ Player p = e.getPlayer(); PlayerDat pd = DBmanager.PlayerData.get(p.getName()); Block b = e.getBlock(); // p.sendMessage(String.valueOf(b.getType().equals(Material.LOG))); if(pd.pclass.equalsIgnoreCase("lumberjack")&&b...
4
public final int[] randomCARule(int maxLength, int actualLength, Random randNum){ int[] itemArray = new int[maxLength]; for(int k =0;k < itemArray.length;k++) itemArray[k] = -1; if(actualLength == 1) return itemArray; int help =actualLength-1; if(hel...
8
@Override public int calculateThrow(int humanResponse) { currentHumanThrow = humanResponse; if (previousHumanThrow != -1) { String threeDigitKey = Integer.toString(previousHumanThrow) + Integer.toString(previousComputerThrow) + Integer.toString(currentHumanThrow); in...
8
public Collection<T> saveOrUpdateAll(Collection<T> entities) { if (entities != null) for (T entity : entities) { session().saveOrUpdate(entity); } return entities; }
2