text
stringlengths
14
410k
label
int32
0
9
public void reCalcStats() { if (leadership > 92) { // For high Leadership commanders damage = Math.round(leadership + intelligence * 2 / 10); defence = Math.round(leadership * 8 / 10 + intelligence * 2 / 10); } else if (combatPower > 92) { // For high com...
3
public boolean checkBrackets(String brackets) { char[] bracketsArray = brackets.toCharArray(); Stack<Character> result = new Stack<Character>(); int opening = 0; for (int i = 0; i < bracketsArray.length; i++) { if (result.empty()) { if (bracketsArray[i] == ')') { return false; } else { r...
8
public int posWalkForwards(int begin_pos, int end_pos, double tmr, int end_time,int standstill_pos,int standstill_time,int standstill_count){ if (tmr < standstill_time) { double step = (standstill_pos - begin_pos)/(double)standstill_time; return begin_pos + (int)(tmr*step); } else if (tmr>=standstill_time&&t...
5
private void refreshView() { boolean currentAliveStateMPS1, currentAliveStateMPS2; long now = System.currentTimeMillis(); currentAliveStateMPS1 = isMPS1alive(); currentAliveStateMPS2 = isMPS2alive(); if (currentAliveStateMPS1 != lastAliveStateMPS1) lastAliveStateC...
4
public static void main(String[] args) { //sorting custom object array Employee[] empArr = new Employee[4]; empArr[0] = new Employee(10, "Mikey", 25, 10000); empArr[1] = new Employee(20, "Arun", 29, 20000); empArr[2] = new Employee(5, "Lis...
0
void format(){ boolean isNotFormatted = true; while(isNotFormatted){ if(times[SECOND] >= 60){ times[SECOND] -= 60; times[MINUTE] += 1; } if(times[MINUTE] >= 60){ times[MINUTE] -= 60; times[HOUR] += 1; } if(times[SECOND] < 0 && Math.abs(times[SECOND]) >= 60){ times[SECOND] += 60; ...
9
@EventHandler public void CaveSpiderInvisibility(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getCaveSpiderConfig().getDouble("C...
6
private double calculateOrderPrice(String[] selectedDishes, List<AvailableDish> availableDishs) { double price = 0; for (String selectedDish : selectedDishes) { for (AvailableDish availableDish : availableDishs) { if (selectedDish.equals(availableDish.getDishName())) { ...
3
public void updateVectorField_internal() { double theta = Math.toRadians(m_flowRotate.getValue()); PdMatrix rotation = m_flowReflect.getState() ? Utils.reflectionMatrix(theta / 2) : Utils.rotationMatrix(theta / 2); m_field.setRotation(rotation); m_interpolatedField = new InterpolatedTensorField(m_domai...
9
public void addRight() { int rows[] = types.getSelectedIndices(); if (rows.length != 0) { for (int i : rows) { AccountType type = allTypes.get(i); if (!creditTypes.contains(type)) { creditTypes.add(type); creditModel.addElement(type); } } } }
3
private static int getData(BaseBlock b, Corner c) { if (b.getType() == BlockID.LADDER) { return (c == Corner.NE || c == Corner.SE) ? 3 : 2; } else { return (c == Corner.NE || c == Corner.SE) ? 4 : 1; } }
5
public void exec() { PrintStream out = System.out; String stadt_name = askUserForCity(); CityInfo cityInfo = null; try { cityInfo = lookUpCity(stadt_name); if( cityInfo == null) { out.println("city not found!"); return; } } catch(SQLException e) { out.println("ERROR: looking up c...
5
public ObjectFactory() { }
0
public Locale pop() throws Exception { Locale retVal = null; // Check for stack underflow. if (topPtr < CAPACITY) { retVal = arr[topPtr]; topPtr = topPtr + 1; } else { // In case of underflow, return -1. // TODO: Throw an underflow exception. throw new Exception(); } return retVal; }
1
public boolean equals(Object obj) { if (!(obj instanceof LabelBlock)) { return false; } LabelBlock that = (LabelBlock) obj; if (!this.text.equals(that.text)) { return false; } if (!this.font.equals(that.font)) { return false; } ...
7
@Override public void selectionChanged(TreeSelectionEvent e) { calculateEnabledState(e.getTree()); }
0
@Test public void shouldDecomposeInto3Colours() { DecomposedPixelArray pixels = editor.decomposeRGB(); assertTrue(pixels.red[0] == 255 || pixels.red[10] == 255 || pixels.green[0] == 255 || pixels.green[10] == 255 || pixe...
5
@Override public void enterStatementExpression( Java7Parser.StatementExpressionContext ctx) { // System.out.println(ctx.getChild(0).getChild(2).getChild(0).getText()); if (2 == 2) return; String ans = "-1"; System.out.println(ctx.getText()); if (ctx.getText().equals("s=newTreeSet<>()")) { //Syste...
9
private void addTrees(double x, double y) { for(int i = 0; i < 500; i++) { double tx = x + random.nextGaussian() * 20; double ty = y + random.nextGaussian() * 20; Tree t = new Tree(tx,ty); if(isEmpty(t)) { entities.add(t); } else { t = null; } } }
2
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException { //Initialize LookAndFeel for(UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if(info.getName().equals("Nimbus")) { UIMa...
3
private void write(String chunk_uuid, String chunk) { // TODO Auto-generated method stub FileOutputStream fos = null; try { fos = new FileOutputStream(path+chunk_uuid); } catch (FileNotFoundException e) { // TODO Auto-generated catch block System.out.println("The file in HDFS is broken."); } try {...
2
@EventHandler public void sClick(PlayerInteractEvent event) { Player player = event.getPlayer(); if (event.getClickedBlock().getState() instanceof Sign){ Sign sign = (Sign) event.getClickedBlock().getState(); if(sign.getLine(0).equalsIgnoreCase(ChatColor.BLUE + "[PaintBall]")) { if(player.ha...
6
private void accept() { ConnectionsWorker worker = findWorkerForConnection(); SocketChannel clientSocketChannel = null; SocketChannel proxySocketChannel = null; try { clientSocketChannel = serverSocketChannel.accept(); clientSocketChannel.configureBlocking(f...
5
@Override public void spring(MOB target) { if((target!=invoker()) &&(target.location()!=null)) { if((doesSaveVsTraps(target)) ||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target))) target.location().show(target,null,null,CMMsg.MASK_ALWAYS|CMMsg.MSG_NOISE,L("<S-NAME> avoid(s) setting off a...
8
@Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { if ((this.postOnly) && (!(request.getMethod().equals("POST")))) { throw new AuthenticationServiceException("Authentication method n...
8
private static IFuzzyCommand parseTest(String[] tokens) throws FuzzyParserException { String[] parts = tokens[3].split(","); String setName = parts[0]; IBinaryOperator operator = null; if(parts.length > 1) { operator = getOperatorForName(parts[1]); } switch(tokens[2]) { case "Symmetric": re...
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
public long getAverage() { long sum = 0; for (int i = 0; i < duur.size(); i++) { sum += duur.get(i).longValue(); } return sum / duur.size(); }
1
public void actionPerformed(ActionEvent e) { if (e.getSource() == spin) { if(backList.size()!=0){ log.info(playerName + " named player has " + arCassa + " money before the roll."); log.info("The wheel has been rolled."); String Number; int Bet; int random = randomGenerator(); writeRolled(ra...
6
public Challenger(Integer minimum, Integer maximum, Operator operator, Type type){ this.minimum = minimum; this.maximum = maximum; this.operator = operator; this.type = type; if(operator == null){ operator = Operator.values()[Generator.RandomInteger(0, Operator.values().length)]; } else{ operator...
5
private void adjustBorderInsets() { Insets parentInsets = parent.getInsets(); // May need to adust the height of the parent component to fit // the component in the Border if (edge == Edge.RIGHT || edge == Edge.LEFT) { int parentHeight = parent.getPreferredSize().height - parentInsets.to...
6
protected String convertBaseGraphRelationshipForMatchClause(BaseGraphRelationship baseGraphRelationship) throws InformationProblem { String relStr = ""; // the depth first visitor follows outbound relationships, so relationship should be --> this is an assumption that might break if (baseGraphRelationship !...
9
public static boolean areGraphicsSafeToUse() { if (!GraphicsEnvironment.isHeadless()) { if (HEADLESS_CHECK_RESULT == 0) { // We do the following just in case we're in an X-Windows // environment without a valid DISPLAY device... try { GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScr...
4
int indexOf(String s, int ch) throws BadBytecode { int i = s.indexOf(ch, position); if (i < 0) throw error(s); else { position = i + 1; return i; } }
1
public static void loadTree(Task tree, File path) throws Exception { /* must be a directory */ if (!path.isDirectory()) throw new Exception("'" + path.getPath() + "' not a directory"); File indexFile = new File(path, INDEX_FILE); if (indexFile.exists()) { /* the index file exists, load nodes based on the in...
8
public final static Date XMLGregorianCalendarToDate(XMLGregorianCalendar gc) throws DateConverterException { if(gc == null) throw new DateConverterException("The input is null "); return gc.toGregorianCalendar().getTime(); }
1
private void swapTerms(int ind1, int ind2){ if(ind1 != ind2){ Term store = new Term(polynomial.get(ind1)); polynomial.set(ind1, polynomial.get(ind2)); polynomial.set(ind2, store); } }
1
public void tellAdmins(String name, String message){ //general chat if (message==null || message.length()==0) return; for (ChatServerThread thread : threads){ if (thread!=null && thread.isLoggedIn() && thread.getIsAdmin()) thread.tell(name, message); } }
6
@Override public void run() { for (;;) { try { DataInputStream in = new DataInputStream(new BufferedInputStream(socket.getInputStream())); DataOutputStream out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())); BufferedRead...
9
public void testUnique() throws Exception { //Return if this is not Windows OS if (!isWindows) { return; } /* * Number of timestamps to generate on each client */ int iterations = 11000; /* * Number of client threads */ ...
8
public static String getKeysFromValue(HashMap<Integer, String> hm, String value) { Set<?> s = hm.entrySet(); // Move next key and value of HashMap by iterator Iterator<?> it = s.iterator(); while (it.hasNext()) { // key=value separator this by Map.Entry to get key and value Map.Entry m = (Map.Entry) it...
4
public static void main(String[] args) throws Exception { File activeUsers = new File("activeUser.txt"); if (!activeUsers.exists()) { System.exit(0); } GraphIndexing graphIndexing = new GraphIndexing(activeUsers); TreeMap<Integer, UserFollowers> map = graphIndexing.buildMap(); System.out.println("buildMa...
1
@Override public void initializeBoard(PieceLocationPair[] initialPieces) { gameboard.clear(); for(PieceLocationPair pair : initialPieces) { BasicHantoPiece piece = new BasicHantoPiece(pair.pieceType, pair.player); BasicCoordinate location = new BasicCoordinate(pair.location); gameboard.put(location.getkey...
7
public void doGet( HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String script = request.getParameter("bsh.script"); String client = request.getParameter("bsh.client"); String output = request.getParameter("bsh.servlet.output"); String captureOutErr...
8
@Override public boolean hasStackInSlot(int slot) { return inventory[0] == null ? false : true; }
1
public static void main(String[] args) { Scanner entrada = new Scanner(System.in); Integer seguir=0; while (seguir!=1) { System.out.println("Digite la identificacion"); int cedula=entrada.nextInt(); System.out.println("Digite el nombre completo del cliente"); Str...
7
public void validateErrors() { for (int i = 0; i < areaParams.length; i++) { if (((BaseValidator) areaParams[i].getKeyListeners()[0]).hasError) { areaParams[i].setBackground(Color.RED); hasErrors = true; } } for (int i = 0; i < baseCounter....
8
public Transition copy(State from, State to) { String[] s = new String[0]; return new TMTransition(from, to, (String[]) toRead.toArray(s), (String[]) toWrite.toArray(s), (String[]) direction.toArray(s)); }
0
static public HashMap<String,String> readProperties(String configString) { final HashMap<String,String> map = new HashMap<String,String>(); int endLineIndex; for (int startIndex = 0; startIndex < configString.length(); startIndex = endLineIndex + 1) { endLineIndex = ...
5
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int length = s.length(); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' ...
6
public boolean testSecndCell() { for (int i = 0; i < this.fristCell.cellPiece.availableCells.length; i++) { if (this.fristCell.cellPiece.availableCells[i] == null) { this.fristCell.cellPiece.searchAvailableCells(); continue; } else { this.fristCell.cellPiece.searchAvailableCells(); } if (secn...
3
public void loadStats(BlackjackGui gui) { switch(gui.numPlayers) { case 1: try { File file1 = new File(players.get(0).getName() + ".txt"); BufferedReader reader = new BufferedReader(new FileReader(file1)); String line; line = reader.readLine(); String [] stats1 = line.split("\\s+...
6
public void displayEvent(String msg, Character ch){ if (ch == null){ stream.logEvent(msg); return; } switch(ch.getType()){ case ALLY: stream.allyEvent(msg, ch); break; case BOSS: stream.bossEvent(msg, ch); break; ...
4
public static String getXmlDeclaration(String version) { if (version == null) { version = DEFAULT_XML_VERSION; } return new StringBuffer().append("<?xml version=\"").append(version).append("\"?>").toString(); }
1
public Player getPlayer1() { boolean test = false; if (test || m_test) { System.out.println("Game :: getPlayer1() BEGIN"); } if (m_player1 == null) { System.out.println("Game::GetPlayer1 - " + "m_player1 has not yet been set"); throw n...
5
public void setName(String name) { this.name = name; }
0
@Test public void multiThreadSubscribeAndUnsubscribe() throws InterruptedException { final LocalTurtleEnvironment env = getTurtleEnvironment(); final int subAndUnsub = 50; ExecutorService pollsubAndUnsub = Executors.newFixedThreadPool(subAndUnsub); for (int i = 0; i < subAndUnsub;...
4
public boolean dialog(){ Font font1 = new Font("Default", Font.PLAIN, 12); Font font1small = new Font("DefaultSmall", Font.PLAIN, 12); //creates the dialog Dialog = new JFrame("Jython Runner Settings"); directory = new JTextField("",20); macrotorun = new JTextField("",20); JLabel labeldir = new JLabel("...
7
private void initButtons() throws SlickException { buttons = new buttonPress[button_count]; for(int i = 0 ;i < button_count ;i++){ buttonPress button; if(i == 0){ button = new MovebuttonPress(); } else if(i == 1){ button = new UnseenbuttonPress(); } else button = new buttonPress(); ...
3
protected int partition(int attIdx, int[] index, int l, int r) { double pivot = m_Instances.instance(index[(l + r) / 2]).value(attIdx); int help; while (l < r) { while ((m_Instances.instance(index[l]).value(attIdx) < pivot) && (l < r)) { l++; } while ((m_Instances.instance(in...
8
public static MeetingRoom getMeetingRoom(int meetingID){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { Statement stmnt ...
5
@Override public void run() { Random r=new Random(seed); long arbeitsgeschwindigkeit=100l; //in Millisekunden while(!stop){//Liefere solange bis stop() aufgerufen wird try { Thread.sleep(arbeitsgeschwindigkeit); } catch (InterruptedException e) { e.printStackTrace(); } int bestandTeilZfZah...
8
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MeterNeedle)) { return false; } MeterNeedle that = (MeterNeedle) obj; if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return f...
9
public AIThread(String name, String server, String password, AIInterface ai, Status connectionstatus) { try { this.ai = ai; this.setName("AI-Thread for " + name); pfactory = new PacketFactory(); GameNetworkInterface gn = Guice.createInjector(ne...
6
public void testDajGoste() { Osoba o=new Osoba(); o.setImePrezime("Alen Kopic"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { o.setDatumRodjenja(sdf.parse("1992-10-21")); } catch (java.text.ParseException p) { System.out.println(p.toString()); } o.setAdresa(...
4
@Override public void keyPressed(KeyEvent e) { int k = e.getKeyCode(); if (!Virucide.gotuser) { if (k == KeyEvent.VK_ENTER) { Virucide.u.enter(); } else if (k == KeyEvent.VK_BACK_SPACE) { Virucide.u.backSpace(); } else if (!(k == Ke...
8
@Override protected void validate(T object) { boolean dirty = false; for (Painter<T> p : painters) { if (p instanceof AbstractPainter) { AbstractPainter<T> ap = (AbstractPainter<T>) p; ap.validate(object); if (ap.isDirty()) { dirty = true; break; } } } clearLocalCacheO...
3
public static byte[] unZipItOnlineWithCache(String zipFileURL, String filename) { byte[] out = null; //fetching if not already fetched byte[] zipbytes = null; if (zipOnlineCacheName1.equals(zipFileURL)) { zipbytes = zipOnlineCacheData1; } else if (zipOnlineCacheName2....
8
private Boolean preFlightSanityChecks() { // check whether user entered both values for template id/template file if (!this.templateID.equals("") && !this.templateFile.equals("")) { JenkinsLogger .error("Values were provided for both template id and file. Please provide just one or the other."); return ...
9
private void editAtomaton(String s) throws Exception { if (s.matches("^\\(START\\) \\|- [0-9]+") && !startGevonden) { s = s.replace("(START) |- ", ""); automaton.setStart(Integer.parseInt(s)); startGevonden = true; } else if (s.matches("[0-9]+ -\\| \\(FINAL\\)$") && !...
9
@Path("createUser.html") @Produces(MediaType.TEXT_HTML) @GET public Response getCreateUserView(@CookieParam("authUser") String token, @QueryParam("message") String message) { try { UserToken verifiedUserToken = doVerifyUserToken(token); //Make sure they are logged in ...
5
private LinkedList<Vertex> BFSFloodFill(Vertex start){ Hashtable<Vertex,Color> color=new Hashtable<Vertex,Color>(); LinkedList<Vertex> reached = new LinkedList<Vertex>(); LinkedList<Vertex> vertices = graph.getVertices(); Iterator<Vertex> j = new Iterator<Vertex>(vertices); while...
4
private void chooseStartingTile(Match match, int number) { Tile[][] tiles = match.getTiles(); int height = tiles.length; int width = tiles[0].length; if (number == 0) { tile = tiles[0][0]; } else if (number == 1) { tile = tiles[height - 1][0]; } el...
4
private void drawArrowhead(Graphics g, Edge e) { int x = e.getEnd().getX(); int y = e.getEnd().getY(); int startX = e.getStart().getX(); int startY = e.getStart().getY(); /** * Calculate delta between start and end x and y */ double deltaX = x - startX; ...
0
private ArrayList<Integer> getReel(String type) { List<String> reel = plugin.configData.config.getStringList("types." + type + ".reel"); ArrayList<Integer> parsedReel = new ArrayList<Integer>(); for(String m : reel) { String[] mSplit = m.split("\\,"); int i = Integer.parseInt(mSplit[1]); while(i > ...
2
public static void main(final String[] args) throws InterruptedException { // Einlesen Properties-Daten final Data data; // Name von Properties-File als Argument String nameOfPropertiesFile = ""; // Argument könnte Name für Properties-File sein if (args.length > 0) { ...
9
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb =new JSONObject(); boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (isMultipart) { FileItemFactory factory = ne...
7
@Override public void run() { System.out.print("."); if (strafing){ float yaw = (float) ((gyro[0]-start_pos)/20.0); double rearValue = speed + -yaw; double rightValue = (-speed / 2.0) + -yaw; double leftValue = (-speed / 2.0) + -yaw; //Update Motor Values FL....
2
void splitMoney(Entity thnStore, int money) { if (money == 0) { return; } if (thnStore.BLN_POPUP) { thnStore.send(""+(char)33+"You have lost "+money+" gp\n"); } else { thnStore.chatMessage("You have lost "+money+" gp\n"); } thnStore.ZENY -= money; int i, i2=0; Vector vctStore; if (t...
9
public int send (Connection connection, Object object, SocketAddress address) throws IOException { DatagramChannel datagramChannel = this.datagramChannel; if (datagramChannel == null) throw new SocketException("Connection is closed."); synchronized (writeLock) { try { try { serialization.write(connect...
3
@Override public boolean loadInstruments(Soundbank soundbank, Patch[] patchList) { boolean success = true; for (Synthesizer s : theSynths) if (!s.loadInstruments(soundbank, patchList)) success = false; return success; }
2
private RepositoryDescriptor getContentJarDescriptor(File jarFile) { InputStream contentsFileInputStream = null; ZipFile zipFile = null; try { zipFile = new ZipFile(jarFile); ZipEntry entry = zipFile.getEntry("content.xml"); if (entry != null) { logger.debug(Messages.RESOLVED_JAR_FILE.value(entry.get...
7
private void generateRanomizedList(int studentCount) { for (int i = 0; i < studentCount; i++) { Student student = generateRandomStudent(); students[i] = student; } }
1
public static void nofailAssertEquals(Object expectedObject, Object testObject) { if (!expectedObject.equals(testObject)) { System.out.println("Expected <" + expectedObject + "> \nfound <" + testObject); } }
1
public static String getPropertyString(String name) { if(!new File(PROP_FILE).exists()) { PROP_FILE = "/usr/share/tomcat7/.jenkins/jobs/PlagiatsJaeger/workspace/WebContent/WEB-INF/classes/config.properties"; } Properties prop = new Properties(); try { // load a properties file prop.load(new Fi...
2
public synchronized void removeCommandLineListener(CommandLineListener listener){ if (this.listeners != null && this.listeners.contains(listener)){ List<CommandLineListener> listeners = new ArrayList<CommandLineListener>(this.listeners); listeners.remove(listener); this.listeners = listeners; } }
2
public static void sendMessageToServer(String from, String message) { List<World> worlds = Core.getPlugin().getServer().getWorlds(); for (Iterator<World> i = worlds.iterator(); i.hasNext();) { World w = i.next(); sendMessageToWorld(w, from, message); } }
1
protected static Ptg calcMid( Ptg[] operands ) { String s = String.valueOf( operands[0].getValue() ); if( (s == null) || s.equals( "" ) ) { return new PtgStr( "" ); // Don't error out if "" ala Excel } if( (operands[1] instanceof PtgErr) || (operands[2] instanceof PtgErr) ) { return new PtgErr( P...
8
public void newAuction(String title, String duration, String auctionType, String desc, String img, String lowPrice, String startPrice, String buyout, String delivery, Account seller, String category, String time) { Auction auction = new Auction(title, duration, auctionType, desc, img, lowPrice, startPr...
0
@Override public void start(CommandSender sender, String[] args, String permissionNode) { if (args.length == 1){ if (sender.hasPermission(permissionNode)) { if (sender instanceof Player){ LL.configHandler.reloadConfig(); if (LL.configHandler.RELOAD){ LL.MSG.commandReply(sender.getName(), C...
9
public static String formatName(String name) { String iName = name.toLowerCase(); if(iName.contains("_") || iName.contains(" ")){ String[] cName = null; if(iName.contains("_")) cName = iName.split("_"); if(iName.contains(" ")) cName = iName.split(" "); String fName = cName[0].substring(0,1).toUp...
4
public static void setDefaultMenuBar(JMenuBar menuBar) { if (Platform.isMacintosh()) { Application.getApplication().setDefaultMenuBar(menuBar); } }
1
private void copyRGBtoBGRA(ByteBuffer buffer, byte[] curLine) { if(transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for(int i = 1, n = curLine.length; i < n; i ...
6
public Player getMyPlayer() { for (int playerIndex = players.length - 1; playerIndex >= 0; --playerIndex) { Player player = players[playerIndex]; if (player.isMe()) { return player; } } return null; }
2
@Override @Transactional public List<Employee> getAll() { List<Employee> employees = sessionFactory.getCurrentSession().createQuery("from Employee e").list(); return employees; }
0
public static boolean isProbabilistMatrix(double[][] matrix, double precision) { boolean isProbabilist = true; int i = 0; while (isProbabilist && i < matrix.length) { double somme = 0.0; for (int j = 0; j < matrix[i].length; j++) { somme += matrix[i][j]; ...
3
private SqlSessionFactory getSqlSessionFactory(String environment, String configFile) { Map<String, SqlSessionFactory> tempSqlSessionFactoryMap = FACTORY_MAP; if (!tempSqlSessionFactoryMap.containsKey(environment)) { synchronized (LOCK) { if (!tempSqlSessionFactoryMap.contain...
5
public double[] computePowerSpectrum(double[] dataReal) { double sum = 0; for (int i = 0; i < dataReal.length; i++) { sum += dataReal[i]; } if (sum == 0) return computeMagnitude(dataReal); double multiplicator = 2.0 / sum; double multiplicatorQua...
3
public Dame(final Couleur couleur, final int position) { super(position); this.couleur = couleur; setOpaque(false); switch (couleur) { case BLANC : setForeground(Color.WHITE); setBackground(new Color(220, 220, 220)); break; case NOIR : setForeground(new Color(70, 70, 70)); setBackgroun...
2
public void drawCard(PlayerClass pPlayer) { pPlayer.cout.printGiftCards(x); for(int i = 0; i < this.players.length; i++) // { if(this.players[i].stillPlaying && this.players[i] != pPlayer) { this.players[i].transaction(pPlayer, x); } } }
3