text
stringlengths
14
410k
label
int32
0
9
public double getMaxWeightedSum(){ /* int[][][] weights = new int[][][] { new int[][]{ new int[] { 8, 16, 32, 64}, new int[] { 4 , 8 , 16 , 32}, new int[] { 2 , 4 , 8 , 16}, new int[] { 1 , 2 , 4 , 8} }, new int[][]{ new int[] { 64, 32, 16...
4
public void paint(Graphics g){ //iniciliazn el DoubleBuffer if(imaImagenJFrame == null) { imaImagenJFrame = createImage (this.getSize().width, this.getSize().height); graGraficaJFrame = imaImagenJFrame.getGraphics(); } // creo imagen p...
6
public List<SoftwareSystem> generateAlternativesEP() { if (project.getDeploymentAlternatives().size()==0) generateAllDeploymentAlternatives(); generateHardwareSetAlternativesEP(); generateHardwareSystemAlternativesEP(); return generateSystemsEP(); }
1
public void firstPassingNode(Element e) { if(e.getLocalName().equals(StringDefinitions.DIAGRAMS_STRING)) { return; } else if(e.getLocalName().equals(StringDefinitions.CLASS_STRING)) { handleClass(e); } else if (e.getLocalName().equals(StringDefinitions.ASSOCIATION_STRING)) { handleAssociation(e); ...
8
void fireWait(ComponentAccess w) { if (shouldFire) { fire(Type.WAITING, new ComponentEvent(c, w.getComponent())); } }
1
public static void beenden() throws IOException { final JFrame Beenden = new JFrame("Ein Frame zum Schließen"); Properties spielstand = loadProperties("spielstand.txt"); Beenden.setTitle("Spiel beenden"); Object[] options = {"Speichern", "Beenden", "Abbrechen"}; int beenden = JOptionPane.sh...
8
@Override public Object getValueAt(int i, int i1) { Object devuelto = null; switch (i1) { case 0: devuelto = datos.get(i).getTitulo(); break; case 1: devuelto = datos.get(i).getFecha_Limite(); ...
3
public void testGet_DateTimeField() { DateMidnight test = new DateMidnight(); assertEquals(1, test.get(ISO_DEFAULT.era())); assertEquals(20, test.get(ISO_DEFAULT.centuryOfEra())); assertEquals(2, test.get(ISO_DEFAULT.yearOfCentury())); assertEquals(2002, test.get(ISO_DEFAULT.year...
1
public List<List<Integer>> fourSum(int[] num, int target) { List<List<Integer>> result = new ArrayList<List<Integer>>(); Arrays.sort(num); int length = num.length; for (int i=0;i < length-3 ;i++ ){ for (int j =i+1; j < length-2 ;j++ ){ for (int m = j+1, n = le...
6
public void render() { Renderer.get().draw(background); Iterator<RenderObject> it = renderableActors.iterator(); while(it.hasNext()) { RenderObject ro = it.next(); Renderer.get().draw(ro); } }
1
public Object serialize(YAML yamlAnnotation, Object containingObject, java.lang.reflect.Method getterMethod, java.lang.reflect.Field field, String yamlFieldName, Object yamlFieldValue) { if ("REMOVEME".equals(yamlFieldValue)) { return null; } else { return "MODIFIED"; } }
1
@Override public String toString() { String cacheObjectStr = "NULL"; if (cacheObject != null) { cacheObjectStr = cacheObject.toString(); } return "实际缓存对象[" + cacheObjectStr + "],版本[" + version + "]"; }
1
@Override public void actionPerformed(ActionEvent e) { if("10".equals(e.getActionCommand())){ m.setAsteroidAmount(10); } if("20".equals(e.getActionCommand())){ m.setAsteroidAmount(20); } if("30".equals(e.getActionCommand())){ m.setAsteroidA...
7
public static void update(){ for(int i = 0; i<4; i++){ if(i==0)prev[KeyEvent.VK_LEFT] = pressed[KeyEvent.VK_LEFT]; if(i==1)prev[KeyEvent.VK_RIGHT] = pressed[KeyEvent.VK_RIGHT]; if(i==2)prev[KeyEvent.VK_UP] = pressed[KeyEvent.VK_UP]; if(i==3)prev[KeyEvent.VK_DOWN] = pressed[KeyEvent.VK_DOWN]; } }
5
public String generate() { String error = "No errors."; if (details) System.out.println("Heightmap flags: PRODUCE="+ioflags.PRODUCE+", SAVE="+ioflags.SAVE+", LOAD="+ioflags.LOAD); if (Utils.flagsCheck(ioflags) != 0) { System.out.println("ERROR: IOFlags object is corrupted, error: "+Utils.flagsCheck(io...
4
public void decisionMaking (){ Scanner sc = new Scanner(System.in); //taking 3 inputs System.out.println("Enter the first number"); int number1 = sc.nextInt(); System.out.println("Enter the Second number"); int number2 = sc.nextInt(); System.out.println("Enter ...
8
public boolean isInDataBase(AlumnoCartaCompromisoDTO alumnocp) { Connection con = null; PreparedStatement pst = null; String sql = null; ResultSet rs = null; int bandera = 0; // Leemos el semestre que termina del archivo de configuración // config.properties ResourceBundle bundle = ResourceBundle.getBun...
6
public byte[] getResponseFromUrl(String urlStr) throws Exception { URL url = new URL(urlStr); int retries = 6; int msWait = 200; while(retries > 0){ InputStream responseStream = null; try { URLConnection connection = url.openConnection(...
5
public static void main(String[] args) throws Exception { // if (args.length != 2) { // System.err.println("Usage: MaxTemperature <input path> <output path>"); // System.exit(-1); // } String input = "/Users/aaronwong/Documents/workspace_java/DataPreprocessing/src/data/out_countries.list"; S...
1
@Override public void salvar(Secao secao, Evento evento) { try { conn = ConnectionFactory.getConnection(); String sql = "INSERT INTO secao (id, nome, valor, idevento) " + "VALUES ((SELECT NVL(MAX(id),0)+1 FROM secao), ?, ?, (SELECT id FROM evento WHERE nome = ...
2
private Object toValue(String name, double[] vals, Map<String, Object> parameter) { Object orig = parameter.get(name); if (orig.toString().indexOf('{') > -1) { // this is an array (hopefully 1dim) return Conversions.convert(vals, String.class); } else { return...
1
private void setAnchorPointForRectangularShape(int i, float x, float y, float w, float h) { switch (i) { case UPPER_LEFT: anchorPoint.setLocation(x + w, y + h); break; case UPPER_RIGHT: anchorPoint.setLocation(x, y + h); break; case LOWER_RIGHT: anchorPoint.setLocation(x, y); break; case LOW...
8
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 void crowdControlled(int debuff){ if (debuff == EARTH){ entombed = true; } else if (debuff == WATER){ slowed = true; } else if (debuff == WIND){ knockedback = true; } else{ stunned = true; } }
3
public double[] standardizedItemVariances(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.standardizedItemVariances; }
2
private static void createAndShowGUI(int nbugs) { JFrame f = new JFrame("Swarm Demo"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); double dt = 0.01; int ddt = 20; if (nbugs > 20) { dt = 0.1; ddt = 2; } Playfield p = new Playfield(nbug...
1
@Override public void run() { gui = new RecvGUI(); try { s = new Socket( srcaddr, 9988 ); DataInputStream in = new DataInputStream( s.getInputStream() ); DataOutputStream out = new DataOutputStream( s.getOutputStream() ); String filename = in.readUTF(); int filesize = in.readInt(); System.out.pri...
5
public void func_4157_a(double[] var1, double var2, double var4, int var6, int var7, double var8, double var10, double var12) { int var14 = 0; for(int var15 = 0; var15 < var6; ++var15) { double var16 = (var2 + (double)var15) * var8 + this.field_4292_a; for(int var18 = 0; var18 < var7; ++...
6
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Menu)) { return false; } Menu other = (Menu) object; if ((this.id == null && other.id != null) || (this.id != n...
5
private String getNextWord(int index) { int start = indexOfNextNameChar(index); if (start == -1) { return null; } int end = indexOfNextNonNameChar(start); if (end == -1) { end = chars.length; } int length = end - start; char[] word = new char[length]; System.arraycopy(chars, start, word, 0, le...
2
public static HashMap<String,HitScores> getTopHitsFilteredByPercentIdentityAtMinLength( String filepath, int minLength) throws Exception { //Query id, Subject id, % identity, alignment length HashMap<String, HitScores> map= new HashMap<String, HitScores>(); BufferedReader reader = new BufferedReader(new...
6
public void earnBonus() { int luckyEmployee=numGen2.nextInt(6); System.out.println("Employee "+luckyEmployee+" won the bonus!"); employees[luckyEmployee].earnBonus(); }
0
public int wepATK() { return inventory.getItem(0).getATK(); }
0
private void findNext () { while (ts.isEmpty () && !toVisit.isEmpty ()) { Node<T> n = toVisit.remove (toVisit.size () - 1); visitedNodes++; n.expand (mbr, converter, ts, toVisit); } if (ts.isEmpty ()) { next = null; } else { next = ts.remove (ts.size () - 1); dataNodesVisited++; } ...
3
public void run() { StringBuilder s = new StringBuilder(); for (int i = 0; i < FINISH_LINE; i++) s.append("="); // The fence on the racetrack print(s); for (Horse horse : horses) print(horse.tracks()); for (Horse horse : horses) if (horse.getStrides() >= FINISH_LINE) { print(horse + "won!...
3
public void setLevelSize(int width, int height) { if(tileGrid == null) { gridWidth = width; gridHeight = height; tileGrid = new Tile[height][width]; for(int i = 0; i < height; i++) { tileGrid[i] = new Tile[width]; } } }
2
public WorldPanel(World world) { this.model = world; this.worldMap = model.getWorldMap(); JLabel label; BufferedImage gold = null; BufferedImage pit = null; BufferedImage wumpus = null; // BufferedImage hunter = null; // BufferedImage empty = null; try { gold = ImageIO.rea...
9
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
6
private void detectedFile(DetectionType type, File file) { String name = file.getPath(); if(name.endsWith(".xml")) { name = name.substring(0, name.lastIndexOf('.')); name = name.substring(name.lastIndexOf(File.separator) + 1); if(type == DetectionType.ORIGINAL || type == DetectionType.CREATE) { this.co...
3
private int getNumberBySlot(int slot) { slot--; // skip this parameter (not an outer value) for (int i = 0; slot >= 0 && i < headCount; i++) { if (slot == 0) return i; slot -= head[i].getType().stackSize(); } return -1; }
3
public static void main(String[] args) { System.out.println("Please enter two integers: "); int a = inputInt(); int b = inputInt(); if (a >= 0 && b >= 0) { System.out.println("Both are positive or zero."); } else { System.out.println("One or both are negative."); } }
2
public static boolean loadDB(ResultSet res, String userName) { try { PlayerData.userName = userName; coins = res.getInt("Coins"); playtime = res.getLong("Playtime"); lck_lvl = res.getString("lck_lvl").getBytes(); lck_bg = res.getString("lck_bg").getBytes(); lck_chr = res.getString("lck_chr").getByte...
1
public static void main(String args[]) { if (args.length != 1) { System.out.println("Usage: CreateArffFromFragmentStats prop.properties"); return; } PropertyHandler propHandler = new PropertyHandler(requiredProps); Properties properties; FileInputStream is; FileOutputStream os; ...
6
@Test public void testProfileCrudUsingToken() { Gateway beanstream = new Gateway("v1", 300200578, "4BaD82D9197b4cc4b70a221911eE9f70", // payments API passcode "D97D3BE1EE964A6193D17A571D9FBC80", // profiles API passcode "4e6Ff318bee64EA391609de89aD4CF5d");// r...
6
public BTPosition<T> getMax(BTPosition<T> root) { if (root == null) return null; BTPosition<T> current = root; while (current.getRight() != null) { current = current.getRight(); } return current; }
2
private void updateRollOver() { boolean wasBorderShown = mShowBorder; Point location = MouseInfo.getPointerInfo().getLocation(); UIUtilities.convertPointFromScreen(location, this); mShowBorder = isOver(location.x, location.y); if (wasBorderShown != mShowBorder) { repaint(); } }
1
public static int divide(int dividend, int divisor) { long p = Math.abs((long)dividend); long q = Math.abs((long)divisor); int ret = 0; while (p >= q) { int counter = 0; while (p >= (q << counter)) { counter++; } re...
6
protected void threadStopped() { // do nothing }
0
private void install(String[] commandString, Player player) throws CommandException { if (commandString.length > 1) { String componentName = ""; for (int i = 1; i < commandString.length; i++) { componentName += " " + commandString[i]; } componentNa...
8
public void VerificaColisao(Polygon colisor, String tag) { for (Point vertice : vertices) { Point ponto = new Point(vertice); if (colisor.contains(ponto)) { this.tag = tag; delete = true; } } }
2
public void run() { String nick = null; try { String s = null; String pm = null; out.write("User connected to port: " + sock.getPort()); out.newLine(); out.flush(); out.write("Enter desired nickname: ...
7
public static void isTrue(boolean expression, String message) { if (!expression) { throw new IllegalArgumentException(message); } }
1
private void readAndDecompress() throws IOException { // Read the length of the compressed block int ch1 = in.read(); int ch2 = in.read(); int ch3 = in.read(); int ch4 = in.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); inLength = (...
9
public void update(Observable o, Object arg) { AnalysePanel p = Main.analyseFrame.getCurrentPanel(); getAction(Constantes.REDO).setEnabled(p.getRedoEnabled()); getAction(Constantes.UNDO).setEnabled(p.getUndoEnabled()); getAction(Constantes.CUT).setEnabled(p.getCopyEnabled() && p.getPasteEnabled()); getActio...
1
protected void displayMultipleRunPane(Environment env){ MultipleSimulateAction act = new MultipleSimulateAction((Automaton)myObjects.get(0),env); act.performAction(env); }
0
@Override public void actionPerformed(ActionEvent e) { openOutlinerDocument(getProtocol()); }
0
public static String dbFileChooser() { Path path = null; // get the path where our jar file is executing try { path = Paths.get(MICE.class.getProtectionDomain().getCodeSource().getLocation().toURI()); } catch (URISyntaxException e) { e.getMessage(); } JFil...
3
protected void process() throws IOException { // INPUT file 1 BufferedReader bfr = new BufferedReader(new InputStreamReader( new FileInputStream((String)file_input_old.getSelectedItem()), encoding_old.getSelectedItem().toString())); Modifier myModifier = new RegexModifier(">", 0, "\t"); Reader modifyingRe...
8
@Override protected void drawInternalU(UGraphic ug, Area area, boolean withShadow) { final StringBounder stringBounder = ug.getStringBounder(); final double textHeight = getTextHeight(stringBounder); ug.getParam().setColor(getForegroundColor()); final double x2 = arrowWidth - 3; if (getArrowConfiguration()...
7
public void itemStateChanged(ItemEvent e) { //create a new font object. Font font; //if these are selected, do this code. if(boldBox.isSelected() && italicBox.isSelected()){ font = new Font("Serif", Font.BOLD + Font.ITALIC, 14); } else if(italicBox.isSelected()){ font = new Font("Serif",...
4
public static double[][] toHomogeneousCoordinates(double[][] m) { int mRows = m.length; int mColumns = m[0].length; double res[][] = new double[mRows + 1][mColumns + 1]; for (int i = 0; i < mRows; i++) { for (int j = 0; j < mColumns; j++) { res[i][j] = m[i][j]; } res[i][mColumns] = 0; } for (in...
3
public static Object decodeToObject( String encodedObject ) { // Decode and gunzip if necessary byte[] objBytes = decode( encodedObject ); java.io.ByteArrayInputStream bais = null; java.io.ObjectInputStream ois = null; Object obj = null; try { bais = new java.io.ByteArrayInputStream( objBytes ); ...
4
private String read_block(char[][] ct) { //read the block horizontally StringBuilder sb=new StringBuilder(); for(int i=0;i<ct[0].length;i+=period) { int end=i+period>ct[0].length?ct[0].length:i+period; for(int j=0;j<ct.length;j++) { for(int k=i;k<end;k++) { if(ct[j][k]!='\0') { ...
5
@Override public int getMetricInternal() { // System.out.println("SW2"); do { EflUtil.runToAddressNoLimit(0, 0, 0x374cf); // after SlotMachine_374fb EflUtil.runToAddressNoLimit(0, 0, 0x374cc); // before SlotMachine_374fb if (curGb.readMemory(0xcd3d) != 2) // wrong wheel return 0; // ...
8
public JSeparator getjSeparator1() { return jSeparator1; }
0
public static void main (String[] args) throws java.lang.Exception { if (args.length < 1) { System.out.println("Usage: java -cp unscramble.jar Main <file names>"); return; } // The following string is the package's name, used as content unscrambling key // Refer to refactored ScrambleReader code... here's...
5
protected void doSortWorker(ActorManager manager, int nest, List<Comparable> values, String id, PendingMerge pm) { sleep(1000); if (values.size() <= 1) { DefaultMessage dm = new DefaultMessage("sortComplete", new Object[] { nest, values, id }); logger.info("send size complete %s(%d): %s", id, nest, values); ...
8
public void addUser(String username, String password) throws DuplicateUserException, BadUsernameException, BadPasswordException{ if(username == null || username.length() == 0){ throw new BadUsernameException("Invalid username"); } if(password == null || password.length() == 0){ throw new BadPasswordE...
8
private double getMagic(String word, int idx) { double c; switch (idx) { case 0: c = seahawks.containsKey(word) ? (double) seahawks.get(word) : 0.0; return (c + 1.0) / (60.0 + seahawks.size()); case 1: c = nfl.containsKey(word) ? (double) nfl.get(word) : 0.0; return (c + 1.0) / (60.0 + nfl.size(...
8
public static int addMarks(int index, String value) { if ((index < 0 && index > 9) || (Float.valueOf(value) < 0 && Float.valueOf(value) > 20)) return 0; marks[index] = value; return 1; }
4
protected void initPool() { if (!initialized) { long start = System.currentTimeMillis(); for (int i = 0; i < initialSize; i++) { queue.offer(create()); } initialized = true; if (LOG.isDebugEnabled()) { LOG.debug(StringUtil.concatenateStrings(this.getClass().getSimpleName(), ".initPool: ", ...
3
public static void password() { List<Employee> employee = ExtractEmployees.employee; String password = ""; String tempPassword = null; Scanner sc = new Scanner(System.in); while (tempPassword == null) { System.out.print("Enter your password: "); password = sc.nextLine(); if (password == null || ...
5
public boolean put(Message message) throws DestinationClosedException { boolean isSuccessful = super.put(message); if (!isSuccessful) { if (discardPolicy == MessageDiscardPolicy.DiscardOldest) { // Until successful insert while (!queue.offer(message)) { queue.poll(); } expiryUtil.scheduleFor...
3
public void setCodes(byte[] codes) { byte[] possible = supportedCodes(); List<Byte> newCodesList = new ArrayList<>(maxCodeCount()); int newCount = 0; for (int i = 0; i < codes.length; i++) { byte c = codes[i]; if (Arrays.binarySearch(possible, c) < 0) { throw new IllegalArgumentException("Code " + co...
6
public void setEmployeeCant(int employeeCant) { EmployeeCant = employeeCant; }
0
@Override public void endSetup(Attributes atts) {}
0
private void runSpikingProblem(Evolution evo){ outputScreen.setText(""); int populationSize = Integer.parseInt(populationSizeField.getText()); int generations = Integer.parseInt(generationsField.getText()); SpikingNeuronProblem sn = (SpikingNeuronProblem) problem; List<Individual...
8
@Override public void simpleInitApp() { flyCam.setMoveSpeed(10f); TileLoader loader = TileLoader.getInstance(); Tile[][] map = new Tile[3][3]; Material matone = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Material mattwo = matone.clone()...
3
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try{ if(!Helpers.isValidDouble(jTextField2.getText())){ JOptionPane.showMessageDialog(this, "Please enter valid number for amount", "Number Format Error", JOptionPane.ERROR...
3
public Object dequeue() throws AskFromEmpty { if (count > 0) { QueueElement previous = head; QueueElement current = head.next(); if (previous == searchMax()) { head = head.next(); count--; return previous.getValue(); ...
3
Poblacion recombine(Poblacion p) { Poblacion ret = new Poblacion(p.getSize()); if(p.getSize()%2!=0) { System.err.println("El tamaño de la poblacion debe ser par"); System.exit(1); } int ham; Genotipo uno, dos; for(int i=0; i<p.getSize(); i += 2...
7
public void actionPerformed(ActionEvent e) { requestFocusInWindow(); repaint(); }
0
public void Update(World world) { Intergrate(world); Friction(world); for(int i = 0;i< res.length;++i) { if(res[i] != null) { if(res[i].Quantity>100){res[i].Quantity = 100;} } } }
3
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (null == obj) { return false; } if (getClass() != obj.getClass()) { return false; } LinkDirectionCity eq = (LinkDirectionCity)obj; if...
6
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage("Commands are designed to be run by players only."); return true; } Player player = (...
8
@Override public void startSetup(Attributes atts) { int size = 10; try { size = Integer.parseInt(atts.getValue(A_SIZE)); } catch (NumberFormatException e) {} JTextField component = new JTextField(size); setComponent(component); super.startSetup(atts); component.addFocusListener(new TextFieldListener(c...
1
private static void PrinterOrder(List<Integer> list){ Iterator<Integer> it = list.iterator(); while(it.hasNext()){ System.out.print(it.next()+":"); } }
1
public void insertar(BeanProducto bean) { if (!dao.buscar(bean) && dao.insertar(bean)) { JOptionPane.showMessageDialog(null, "Se ha agregado un nuevo producto", "Info", 1); } else { JOptionPane.showMessageDialog(null, "El producto ya existe...
2
static public double erfc(double a) throws ArithmeticException { double x, y, z, p, q; double P[] = { 2.46196981473530512524E-10, 5.64189564831068821977E-1, 7.46321056442269912687E0, 4.86371970985681366614E1, 1.96520832956077098242E2, 5.26445194995477358631E2, 9.34528527171957607540E2, 1.027551886895157102...
8
public Object nextContent() throws JSONException { char c; StringBuffer sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new Str...
7
private void topStroke(Location loc, int size){ // If Size == 0 we are done. // If Invalid, we can't move up any further anyway, so stop. if(size == 0 || !grid.isValid(loc)) return; Actor tmp = null; int r = loc.getRow(); int c = loc.getCol(); for(int i = 0; i < size; i++){ Location rightLoc = ne...
7
public double evaluate(double num1,String operator,double num2){ double result = 0; if(0 == operator.compareTo("+")){ result = new Addition(num1, num2).operate(); } if(0 == operator.compareTo("-")) { result = new Substraction(num1, num2).operate(); } ...
5
private boolean pluginFile(String name) { for (final File file : new File("plugins").listFiles()) { if (file.getName().equals(name)) { return true; } } return false; }
2
public static int countFill(int[] landscape, int start) { if (start >= landscape.length - 1) { return 0; } int startIndex = start; int endIndex = 0; int startHeight = landscape[start], endHeight = 0; for (int pos = start; pos < landscape.length; pos++) { ...
9
public boolean send(String text) throws IOException { if (!this.handshakeComplete) throw new NotYetConnectedException(); if (text == null) throw new NullPointerException("Cannot send 'null' data to a WebSocket."); // Get 'text' into a WebSocket "frame" of bytes byte[] textBytes = text.getBytes(UTF8_CHARSET); ...
5
public String[] processCommand(String[] splitLine) { String[] command; if (splitLine.length >= 1) { switch (splitLine[0].toLowerCase()) { case "quit": command = new String[] { QUIT }; break; case "help": command = new String[] { HELP }; break; case "step": if (splitLine.leng...
9
@Override public void paintComponent(Graphics g2) { Graphics2D g = (Graphics2D) g2; Dimension originalSize = super.getSize(); Color above = new Color(66, 122, 241); Color under = new Color(29, 82, 194); if (isPressed) { GradientPaint gradPaint = new GradientPaint(0, 0, above, 0, originalSize.height - 3,...
2
private boolean needsMet(int meetLevel) { if (personnel.residents().size() == 0) return false ; if (meetLevel <= HoldingUpgrades.LEVEL_TENT ) return true ; if (meetLevel > HoldingUpgrades.LEVEL_GUILDER) return false ; final Object met = HoldingUpgrades.NEEDS_MET ; return HoldingUpgrades.ch...
8
public boolean projectionIsOnLine(Point point) { double distance = rawDistanceToPoint(point); Point normal = new Point(pA.getY() - pB.getY(), pA.getX() - pB.getX()); normal.divide(distance(normal, new Point(0, 0))); Point pointOnLine = point.add(normal.multiply(distance))...
9
public void loadRegionDirectory(String dir) throws Exception{ ArrayList<Chunk> chunkslist = new ArrayList<Chunk>(); String[] files = (new File(dir)).list(new FilenameFilter(){ @Override public boolean accept(File file, String filename) { return filename.toLowerCase().endsWith(".mca"); } }); System....
6