text
stringlengths
14
410k
label
int32
0
9
@Override public Object getValue() { Object o = null; ; Formula f = (Formula) getParentRec(); if( f.isSharedFormula() ) { o = FormulaCalculator.calculateFormula( f.shared.instantiate( f ) ); // throw new UnsupportedOperationException ( // "Shared formulas must be instantiated for calculation"); }...
4
protected File getFile(final String key) { return getProperty(key) == null ? null : new File(working_directory, getProperty(key)); }
1
private String getMeleeTier(ItemDefinition definition) { if (definition.wieldRequirements().size() >= 3) { return "HIGH_LEVEL"; } for (CombatSkillRequirement requirement : definition.wieldRequirements()) { if (requirement.getLevel() <= 45) { return "LOW_LEVEL"; } else if (requirement.getLevel() < 70...
4
public int maxProfit(int[] prices) { int[] A = prices; if (A.length < 2) return 0; int buy = 0; int sell = 1; int max = Math.max(A[sell] - A[buy], 0); while (sell < A.length) { max = Math.max(A[sell] - A[buy], max); if (A[sell] < A[buy...
3
private JSONWriter append(String string) throws JSONException { if (string == 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 static void main(String args[]) { long begin=System.currentTimeMillis(); GetOutAuthorRelation getOutAuthorRelation = new GetOutAuthorRelation(); HashMap<String, Map<String, Integer>> map = getOutAuthorRelation .GetOutRelation(4); //86603 for (String key : map.keySet()) { Map<String, Integer> tmp...
2
public void process(Object selectKey){ if(selectKey instanceof SelectionKey){ SelectionKey selectionKey = (SelectionKey)selectKey; Client key = Client.getSockector(selectionKey); if(key.getMessages(charBuffer)){ // 已完成握手,从客户端读取报刊 key.process();// 进行业务处理 } }else if(selectKey instanceof Client){// 直接发...
3
private void checkBlockMult( int operationType , boolean transA , boolean transB , Method method, final int heightA, final int widthA, final int widthB ) { boolean hasAlpha = method.getParameterTypes().length == 10; if( hasAlpha && operationType == -1 ) ...
8
public static void main(String[] args) { int hashSize = 0; if (args.length == 0) { throw new IllegalArgumentException("Syntax: CountsWords Datei [hashSize][RSHash|JSHash]"); } if (args.length >= 1) file = args[0]; if (args.length >= 2) { try { hashSize = Integer.parseInt(args[1]); } catch...
9
private final static ArrayList<String> getRowColAndGapsTrimmed(String s) { if (s.indexOf('|') != -1) s = s.replaceAll("\\|", "]["); ArrayList<String> retList = new ArrayList<String>(Math.max(s.length() >> 2 + 1, 3)); // Aprox return length. int s0 = 0, s1 = 0; // '[' and ']' count. int st = 0; // Start of ...
9
private void btnAlterarProdutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarProdutoActionPerformed try { if (JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0) { carregaObjeto(); if (dao.Salvar(produto)) { ...
3
private void doEditCY(HttpServletRequest request, HttpServletResponse response, boolean isEditUser) throws ServletException, IOException { String chengYuanId = StringUtil.toString(request.getParameter("chengYuanId")); if(!StringUtil.isEmpty(chengYuanId)) { ChengYuan chengYuan = n...
3
public SpriteHuntArgs(Map<String, String> argMap) { boolean _hasErrors = false; String huntColor = "255,0,255"; if (argMap.containsKey("hunt")) { huntColor = argMap.get("hunt"); } Integer parsedHuntColor = parseHuntColor(huntColor); if (parsedHuntColor == null) { _...
9
@Override public Event next() { String input = null; try { input = br.readLine(); } catch (IOException e) { e.printStackTrace(); } //alters state if(input == null || input.equals("")){ return new DefaultState(as); } if(input.equalsIgnoreCase("add")){ return new AuctionCreateState(name, ...
4
public Category decide(Game game) { if (game.getWhichRoll() == 3 || rnd.nextInt(4) == 0) { // Score the dice. int numAvailable = 0; int chosenColumn = -1; Category chosenCategory = null; for (int column = 0; column < 3; column++) { ScoreColumn scoreColumn = game.getCurrentPlaye...
8
@Override public int compareTo(Object other) { if (other instanceof Vortex) { Vortex otherVortex = (Vortex)other; if (otherVortex.dayDistance > this.dayDistance) { return 1; } else if (otherVortex.dayDistance < this.dayDistance) { return -1; } else { if (otherVortex.dayTravel > this.day...
5
public int getWinner() { int player1Score = getScore(1); int player2Score = getScore(2); if (player1Score > player2Score) return 1; if (player2Score > player1Score) return 2; else return 3; }
2
private int processJsrRanges() { List<JsrRecord> lstJsrAll = new ArrayList<>(); // get all jsr ranges for (Entry<BasicBlock, BasicBlock> ent : subroutines.entrySet()) { BasicBlock jsr = ent.getKey(); BasicBlock ret = ent.getValue(); lstJsrAll.add(new JsrRecord(jsr, getJsrRange(jsr, ret)...
9
public Game.PlayerTurn getPlayerTurn() { boolean test = false; if (test || m_test) { System.out.println("Game :: getPlayerTurn() BEGIN"); } if (test || m_test) { System.out.println("Game :: getPlayerTurn() END"); } return m_playerTurn; }
4
public Tree additiveExpressionPro(){ Tree firstConditionalExpression = null, secondConditionalExpression = null; if((firstConditionalExpression = multiplicativeExpressionPro()) != null){ if((secondConditionalExpression = additiveExpressionDashPro(firstConditionalExpression)) != null){ return secondCondition...
2
private int arrayState( char next ) { if ( next == ',' ) { buffer.pop(); next = nextValue(); } switch (next) { case END_ARRAY: { popState(); return returnValue( END_ARRAY, state ); } case '"': { ...
5
public void setCity(String city) { this.city = city; }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof KeyWrapper)) return false; KeyWrapper other = (KeyWrapper) obj; if (cacheName == null) { if (other.cacheName != null) return false; } else if (!cacheName.equals(ot...
9
private void initGenes(){ //0 to n-1 for the cities, n to denote the seperator. Superfluous numbers are being ignored bitsPerAllele = (int) (Math.log(travelingSalesman.n)/Math.log(2)); //2n alleles, as we use pair permutations allelesCount = 2*travelingSalesman.n; bitsPerGene = (allelesCount*bitsPerAllele)...
1
public String[] someoneElse(boolean place) { try{ driver.get(baseUrl + "/content/lto/2013.html"); //global landing page driver.findElement(By.xpath("/html/body/div[2]/div/div/div/div/div/div/div[2]/ul/li/a")).click(); //Austrailia landing page - Order Now button driver.findElement(By.xpath("/...
7
@Override public Object read(JsonReader in) throws IOException { JsonToken token = in.peek(); switch (token) { case BEGIN_ARRAY: List<Object> list = new ArrayList<Object>(); in.beginArray(); while (in.hasNext()) { list.add(read(in)); } in.endArray(); return list; ...
8
public void changeTable(String inFname, String outFname) throws IOException{ TextFile in = new TextFile(inFname, false); TextFile out = new TextFile(outFname, true); String[] els = in.readLineElems(TextFile.tab); getPosToSampleId(els); out.writelnTabDelimited(els); ...
2
public void testSetHourOfDay_int2() { MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8); try { test.setHourOfDay(24); fail(); } catch (IllegalArgumentException ex) {} assertEquals("2002-06-09T05:06:07.008+01:00", test.toString()); }
1
@Override public void draw(Graphics2D g) { super.draw(g); g.drawString(""+Loading.index , 10, 10); //inventory space g.drawImage(img.getSubimage(0, 63, 200, 18), 150, GamePanel.HEIGHT - 25, null); for(int slot = 0; slot < player.getMaxSlots(); slot++){ ItemStack stack = player.getStackInSlot(slot);...
2
private void testDescendingOrder(int numRows, int numCols, boolean compact, boolean testArray ) { SimpleMatrix U,W,V; int minLength = Math.min(numRows,numCols); double singularValues[] = new double[minLength]; if( compact ) { U = SimpleMatrix.wrap(RandomMatrices.createOrtho...
7
public void run() { if(url != null) { // Obtain the results of the project's file feed if(readFeed()) { if(versionCheck(versionTitle)) { String fileLink = getFile(versionLink); ...
6
public void SetMean(double mean) { super.mean = mean; }
0
public Preferences(File prefsFile) { mFile = prefsFile; mPrefs = new Properties(); mNotifier = new Notifier(); if (mFile.exists()) { try (InputStream in = new FileInputStream(mFile)) { mPrefs.loadFromXML(in); } catch (Exception exception) { // Throw away anything we loaded, since the file must be ...
2
public ArrayList<String> tempResultQuery(ArrayList<String> temp, String query) { ArrayList<String> tempResults = new ArrayList<String>(); if (temp.isEmpty()) { docIdResults.clear(); docIdResultsBoolean.clear(); parser.clearStemmerFile(); ArrayList<String> p1 = new ArrayList<String>(); ArrayList<S...
9
@Test public void testSubgroupsOrder() { Collection<Symmetry4D> groups = Symmetry4D.getSymmetries(); int subgroupCounter; boolean isSubgroup; Collection<Rotation4D> groupMembers; Collection<? extends Symmetry<Point4D>> subgroups; for (Symmetry4D g : groups) { subgroupCounter = 0; ...
6
public static void addObservers(Game.Builder b) { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); while (true) { printObservers(); /// int opt = getUserOption(br, 1, 4); /// switch (opt) { ...
5
public void testInverted() { m_Filter = getFilter("1,4,2-3"); ((TimeSeriesTranslate)m_Filter).setInvertSelection(true); Instances result = useFilter(); // Number of attributes shouldn't change assertEquals(m_Instances.numAttributes(), result.numAttributes()); assertEquals(m_Instances.numInstance...
7
public ShortestPaths getShortestPaths() { // Initialize level 0 of the weights pathWeights = new double[graph.vertices()][graph.vertices()][graph.vertices()]; for (int i = 0; i < graph.vertices() - 1; i++) { for (int j = 0; j < graph.vertices() - 1; j++) { if (i == j)...
9
public static JMenuBar createMenuBar() { JMenuBar menuBarUpper = new JMenuBar(); //define and initialized menuBarUpper menuBarUpper.setBackground(new Color(windowColor)); f.setJMenuBar(menuBarUpper); //add the menuBarUpper to the frame JMenu fileMenu = new JMenu("File"); //create the "file" menu JMenu i...
4
public VirtualSequenceNode(Property p,PropertyTree parent,Property pPos,Property pTot) { super(p,parent); pPosition=pPos; pTotal=pTot; }
0
private void indent(final PrintWriter out, final int indent) { for (int i = 0; i < indent; i++) { out.print(" "); } }
1
public void draw(Graphics g, GameContainer gc) { gc.getGraphics().setBackground(sky); int minx = (int) -Math.ceil(drawx/16); int maxx = (int) (Math.ceil(LostAdventure.screenwidth/16))+minx+2; int miny = (int) -Math.ceil(drawy/16); int maxy = (int) (Math.ceil(LostAdventure.screen...
8
public ProfileInfo Get_DataObj(ProfileInfo DataObj) { //System.out.println("ProfileDAO.Get_DataObj()"); ProfileInfo profileObj = (ProfileInfo)DataObj; String sql = "select * from profile WHERE `Profile_Name`=?"; try { con = getConnection(); pstmt = con.prepareStatement(...
7
private int getScore(List<Integer[]> Hand){ int s = 0, a = 0; for (Integer[] i : Hand){ if (i[1] > 9) s += 10; else if (i[1] <= 9 && i[1] > 0) s += i[1] + 1; else if (i[1] == 0) a += 1; } for (int i = 0; i < a; i++){ if (s + 11 <= 21) s += ...
7
private int randomSwitchDirection() { int i; i = (int) Math.floor(Math.random() * 10 + 1); if (i > 5) { return -1; } else { return 1; } }
1
private static int partie(mode type) { int a, b; int i; int rep[] = new int[2]; int faute; //générer des nombre au hasard a = generate(); b = generate(); faute = 0; //calculer la réponse attendu switch(type) { case ADDITION: rep[0] = a+b; break; case SOUSTRACTION: rep[0] = a-b; break; ...
7
boolean matchbracketclass(int c, int poff, int ec) { boolean sig = true; if (p.luaByte(poff + 1) == '^') { sig = false; poff++; } while (++poff < ec) { if (p.luaByte(poff) == L_ESC) { poff++; if (match_class(c, p.luaByte(poff))) return sig; } else if ((p.luaByte(poff + 1) == ...
9
boolean allowMove(int dx, int dy) { int nx = x+dx; int ny = y+dy; int nx2 = x2+dx; int ny2 = y2+dy; int i; for (i = 0; i != sim.elmList.size(); i++) { CircuitElm ce = sim.getElm(i); if (ce.x == nx && ce.y == ny && ce.x2 == nx2 && ce.y2 == ny2) return false; if (ce.x == nx2 && ce.y == ny2 && ce.x2...
9
public void purchase(Integer key, Player player) { switch (key) { case KeyEvent.VK_1: if (player.decreaseCredits(shieldsPrice)) { shieldsPrice += player.getMaxHP()* 3; player.increaseMaxHP(5); player.setHitpoints(player.getM...
8
public static void printResult(String result, String ...spacer_str) { String spacer = getSingleDefault(spacer_str, "-"); int longest_line_length = 1; String[] lines = result.split("\n"); for (int l=0; l<lines.length; l++) { longest_line_length = Math.max(lon...
1
private void beginListening(String address, int port) { Socket s; try { s = new Socket(address, port); } catch (UnknownHostException ex) { onUnsuccessfulConnection(); return; } catch (IOException ex) { onUnsuccessfulConnection(); ...
6
public static FilterConfig XML2java(Element root) { FilterConfig filterConfig = new FilterConfig(); Iterator rootIter = root.elementIterator(); while (rootIter.hasNext()) { Element element = (Element) rootIter.next(); if (element.getName().equals("source")) { filterConfig.setSource(PerserUtil.parserSou...
8
private static List<String> parse(String s) { List<String> keywords = new ArrayList<String>(); StringBuilder buff = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (Character.isLetter(c) || Character.isDigit(c)) { buf...
5
public void setResponse(Object response) { this.response = response; }
0
public long LCM(FactorTree other){ FactorTree lcm = new FactorTree(); for (long n : this.keySet()){ if (other.containsKey(n)){ int powerA = this.get(n); int powerB = other.get(n); int highest = (powerA<=powerB) ? powerB : powerA; ...
5
public Traffic(int yStartingPos){ speed = (int)(Math.random() * 9 + 5); this.yStartingPos = yStartingPos; //randomly assign colours to each new car generated r = (int)(Math.random() * 255 + 1); g = (int)(Math.random() * 255 + 1); b = (int)(Math.random() * 255 + 1); trafficColor = new Color(r,g,b); r2 = (...
3
public void execute() throws IOException { try { // Read the first 8192 bytes. // The full header should fit in here. // Apache's default header limit is 8KB. // Do NOT assume that a single read will get the entire header at once! ...
9
private String[] strinArrayProp(Properties props, String name, String[] defaultValue) { List<String> values = new ArrayList<String>(); for (int i = 0; i < 50; ++i) { String val = props.getProperty(name + "." + i); if (val != null) { values.add(val); } ...
3
public void writeNested(Input child, Element input){ input.appendChild(input); if(child instanceof And){ And casted = (And) child; input.setAttribute("name", "And"); Boolean x = casted.isOptional(); input.setAttribute("optional", x.toString()); for(int i = 0; i < casted.getCondition...
8
static public void copyParamValues(Data source, Data dest) { double[] paramValueArray = new double[source.getParamValues().length]; for (int i = 0; i < paramValueArray.length; i++) { paramValueArray[i] = source.getParamValues()[i]; } dest.setParamValues(pa...
1
public static void main(String[] args) { // TODO code application logic here try{ //Server soket oluşturduk. ServerSocket sSocket=new ServerSocket(21500); System.out.printf("Server basladi."+" " + new Date()+"\n"); //bağlantı isteklerini dinlemeye aldık. ...
9
@Override public void stateChanged(ChangeEvent e) { JSlider source = (JSlider)e.getSource(); if (!source.getValueIsAdjusting()) { jeu.setTimerDifficulte(source.getValue()); level.setText(String.valueOf(source.getValue())); statistique.setNiv...
1
private int[] computeSkirt(TPoint[] points, int width) { int[] skirt = new int[width]; for (int i = 0; i < width; i++) { //impossibly high value int minY = 5; for (int j = 0; j < points.length; j++) { TPoint currentPoint = points[j]; // if point is in right column if (currentPoint.x == i) { ...
4
public void move() { displacementX += xIncrement*constantAcc; displacementY += yIncrement*constantAcc; if (displacementX > box.resolution().width - 5 - 150 || displacementX < 0) { xIncrement = xIncrement *(-1); this.image=box.selectPokemon(); } if (displacementY >box.resolution().height - 30 - 150 || ...
4
int distToPiece(Space[] set, int n, Piece p){ int d = 0; for(int i=n-1;i>=0;i--){ if(set[i].getPiece()==p){ d=n-i; break; } } for(int i=n+1;i<set.length;i++){ if(set[i].getPiece()==p){ if(d==0 || i-n<d) d = i-n; break; } } return d; }
6
public void setColor(int color) { this.color = color; switch (color) { case EMPTY_BOLL: image = new ImageIcon(NULL_BOLL); break; case BIG_RED: image = new ImageIcon(BIG_RED_BOLL); break; case BIG_GREEN: image = new ImageIcon(BIG_GREEN_BOLL); break; case BIG_CYAN: image = new ImageIc...
9
@Override public void mouseReleased(MouseEvent e) { switch(e.getButton()) { case MouseEvent.BUTTON1: //Left click //System.out.println("X: " + cX + ", Y: " + cY + "\t"); selected = Game.map.getUnit(pX, pY); if(Game.gui.canSelect(select...
4
@EventHandler public void onSelectMob(PlayerInteractFakeMobEvent event) { Player player = event.getPlayer(); FakeMob mob = event.getMob(); if (Cache.selectedMobs.containsKey(player) && Cache.selectedMobs.get(player) == null) { Cache.selectedMobs.put(player, mob); player.sendMessage(ChatColor.GREEN + "Mob "...
6
public void decrement() { count.decrementAndGet(); }
0
public IndexedModel toIndexedModel(){ IndexedModel result = new IndexedModel(); IndexedModel normalModel = new IndexedModel(); HashMap<ObjIndex, Integer> resultIndexMap = new HashMap<ObjIndex, Integer>(); HashMap<Integer, Integer> normalIndexMap = new HashMap<Integer, Integer>(); ...
8
public ServerCli(){ _commands.add(new Command("Show Computers")); _commands.add(new Command("Show Time")); _commands.add(new Command("Show Version")); _commands.add(new Command("Exit")); }
0
private ArrayList<Integer> getColours() { ArrayList<Integer> answer = new ArrayList<Integer>(); int i = 0; while(i != colourList.size() && (answer.size() != g.getSolutionSize())) { int j = 0; ArrayList<Integer> temp = new ArrayList<Integer>(); //Guess 4 of one colour while (j != g.ge...
8
public void updateFileComboBox() { fileprojectNameComboBox.removeAllItems(); String[] file_projName_strArray = projectTableController.getProjNameComboBoxesData(); for(String str : file_projName_strArray) { fileprojectNameComboBox.addItem(str); } }
1
@SuppressWarnings("resource") public static boolean registerInstance() { // returnValueOnError should be true if lenient (allows app to run on network error) or false if strict. boolean returnValueOnError = true; // try to open network socket // if success, listen to socket for new instance message, return tru...
8
public static void initializeCollisionGroups(Class<? extends GameObject> type, Class<? extends GameObject>[] list){ boolean isAbstract = Modifier.isAbstract(type.getModifiers()); System.out.println("\tInitializing group: " + type + " w/ " + list); if (isAbstract){ System.out.println("\t\tThis is an abstract ...
6
public Boolean pretarate() { if (this.txt_num_estado.getText().matches("[1-9][0-9]*") && this.txt_num_simbolo.getText().matches("[1-9][0-9]*")) { if (this.txt_num_estado.getText().length() != 0 && this.txt_num_simbolo.getText().length() != 0) { modelTable.setColumnCount(Integer.parse...
4
@Override public boolean equals(Object o){ Time time = (Time) o; if (this.hour == time.hour && this.min == time.min){ return true; } return false; }
2
@Override public final void update(final Observable o, final Object arg) { final HashMap<Program, Integer> unsorted = new HashMap<Program, Integer>(); final Vector<Entity> entities = new Vector<Entity>(field.getEntities()); for (final Entity entity : entities) { fina...
3
private Boolean validateEvent(String eventName, List<MMTFieldValueHeader> fieldValueElements) throws MMTInitializationException { Boolean retval = true; if (this.getProtoConfig() == null) { throw new MMTInitializationException("Initialization Exception: getProtoConfig() returns null. A valid...
4
public static double erfc(double x) { double erfc = 1.0D; if (x != 0.0) { if (x == 1.0D / 0.0D) { erfc = 0.0D; } else { if (x >= 0) { erfc = 1.0D - Stat.incompleteGamma(0.5, x * x); } else { erfc = 1.0D + Stat.incompleteGamma(0.5, x * x); } } } return erfc; }
3
public void sendRequest(String resultObject, JSONRPC2Request jsonrpc2Request){ System.out.println(); System.out.println("Request: " +jsonrpc2Request.toJSONString()); String id = jsonrpc2Request.getID().toString(); URL serverURL = null; try { if(isDevelopment){ ...
8
public static String getOutboundMessage(Packets packet, String data){ String returned; returned = packet.id + "|" + data; return returned; }
0
@Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub synchronized (controller) { controller.notify(); } if ("VIEW LOG FILE".equals(start.getText())) { try { Runtime.getRuntime().exec( "notepad.exe src/Resurces/LogFile/Log.log"); } catch (IOE...
6
private void move() { if(endValuesIndex >= values.size()) { endValuesIndex++; return; } // select next // move start to next stop of values change int compare = values.get(startValuesIndex).getEnd().compareTo( ...
3
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb = new JSONObject(); InputStreamReader reader = new InputStreamReader(request.getInputStream(), "utf-8"); String receivedString = ""; cha...
7
public Atdl4jWidget<?> getAtdl4jWidgetForParameter( ParameterT aParameterRef ) { if ( ( aParameterRef != null ) && ( getAtdl4jWidgetWithParameterMap() != null ) ) { Collection<Atdl4jWidget<?>> tempAtdl4jWidgetWithParameterMapValues = (Collection<Atdl4jWidget<?>>) getAtdl4jWidgetWithParameterMap().values(); ...
8
public void paintSelectedIndex(Graphics g, Camera cam) { if (world != null && world.length > 0 && world[0] != null && world[0].length > 0) { // Draw index near selected tile: if (selectedTile_x >= 0 && selectedTile_x < world.length && selectedTile_y >= 0 && selectedTile_y < world[0].length) { Strin...
8
@Override public Binary get(Object key) { if (!(key instanceof Binary)) return null; final Binary bKey = (Binary) key; final byte[] keyData = bKey.getValue(); final int keySize = keyData.length; final int hash = Math.abs(hashFunction.apply(keyDat...
9
public static void main(String[] args) { PixelFormat pixelFormat = new PixelFormat(8, 8, 8); ContextAttribs attribs = new ContextAttribs(3, 2) .withForwardCompatible(true).withProfileCore(true); try { Display.setDisplayMode(new DisplayMode(1280, 720)); Display.create(pixelFormat, attribs); } catch (LW...
5
public Boolean loadPlayer2() { boolean test = false; if (test || m_test) { System.out.println("Loader :: loadPlayer2() BEGIN"); } if (loadPlayer(getPlayer2File())) { setPlayer2(createPlayerType(m_playerInfo[PLAYER_TYPE_INDEX])); g...
6
public void add(int element) { if(manyItems == data.length) { ensureCapacity((manyItems + 1)*2); } data[manyItems] = element; manyItems++; }
1
@RequestMapping(value="/usuario/cadastrarUsuario", method=RequestMethod.POST) public String cadastrarUsuario(@Valid Usuario usuario, BindingResult result, ModelMap model){ String mensagem = null; if(result.hasFieldErrors("nome") || result.hasFieldErrors("sobrenome") || result.hasFieldErrors("email") || resul...
7
@SuppressWarnings("unchecked") @Override public void insertElementAt(E element, int index) { int size = getSize(); for(index = 0; index < size; index++) { if(comparator != null) { E o = getElementAt(index); if(comparator.compare(o, element) > 0) break; } else { Comparable c = (C...
6
@Override public void update(Observable observable, Object identifyer) { Warborn model = (Warborn)observable; if(identifyer!=null && identifyer.getClass()==Integer.class && (Integer)(identifyer)==1){ switch(model.getState()){ case STARTPHASE: new Thread(new StatePanel(model, frame, "Place Your Troops"))....
7
public void zoneEventOccurred(String eventZone, int eventType) { if(Debug.localMouse) System.out.println("Event occurred of type: "+eventType+ " in zone: "+eventZone); double scaleFactor = 0.9; if(ZoneEvents.PRESS == eventType) { /* //----Horizontal scaling only testPanel.setLocation((int)...
4
private static int alphaBeta(Configuration conf, int alpha, int beta,byte depth,byte max){ if ((conf.whoWin() != 0) || (depth >= max)){ return evaluation(conf); } else{ int meilleur = Integer.MIN_VALUE; for (Configuration fconf : listeFils(conf)) { int suiv=-alphaBeta(fconf, -beta, -alpha, (byte) (de...
6
public static <T extends Enum<?>> T lookup(Map<String, T> lookup, String name, boolean fuzzy) { String testName = name.replaceAll("[ _]", "").toLowerCase(); T type = lookup.get(testName); if (type != null) { return type; } if (!fuzzy) { return null; ...
7
@Override public STAFResult execute(RequestInfo reqInfo) { STAFResult result = super.execute(reqInfo); if (result.rc == STAFResult.Ok) { CommandAction command = null; String parsedCommandName = (parseResult.numInstances() >= 2) ? parseResult.instanceName(2).toUpperCase() : null; LOG.info("Looking for com...
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final IslandLocation other = (IslandLocation) obj; if (!Objects.equals(this.location, other.location)) { ...
3
private void func_72145_a(World par1World, int par2, int par3, int par4, boolean par5, boolean par6, boolean par7, boolean par8) { if (par6 && !par8) { par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.10000000000000001D, (double)par4 + 0.5D, "random.click", 0.4F, 0.6F); ...
8