text
stringlengths
14
410k
label
int32
0
9
short getNumber() { return number; }
0
public Land getSecondLand() { return second_land; }
0
Item newInteger(final int value) { key.set(value); Item result = get(key); if (result == null) { pool.putByte(INT).putInt(value); result = new Item(index++, key); put(result); } return result; }
1
public Point transformFromAutomatonToView(Point point) { return (Point) transform.transform(point, new Point()); }
0
public static void question7() { /* QUESTION PANEL SETUP */ questionLabel.setText("What is your favourite drink?"); questionNumberLabel.setText("7"); /* ANSWERS PANEL SETUP */ //resetting radioButton1.setSelected(false); radioButton...
0
private MazeRoomEnterBehavior getBehavior(RoomType roomType){ MazeRoomEnterBehavior enterBehavior; switch(roomType){ case DOOR: enterBehavior = new DoorRoomEnterBehavior(); break; case EXIT: enterBehavior = new ExitRoomEnterBehavior(); break; case PATH: if(rand.nextDouble() >= .5) enterBeha...
6
public void setAge(String age) { this.age = age; }
0
private static BufferedImage[][][] createImagesFiende() { BufferedImage[][][] bilder = null; BufferedImage[] imgs0 = Bilder.naziN; BufferedImage[] imgs1 = Bilder.naziE; BufferedImage[] imgs2 = Bilder.naziS; BufferedImage[] imgs3 = Bilder.naziW; BufferedImage[] imgs4 ...
6
private static void findPatternInFile( File src, String pattern, Vector<Match> matches, MVD mvd ) throws Exception { short vId = mvd.getVersionByLongName( src.getName() ); if ( vId != -1 ) { int length = (int)src.length(); FileInputStream fis = new FileInputStream( src ); byte[] data = new byte[lengt...
3
public static void spawnHellhound (Location loc, int amount) { int i = 0; while (i < amount) { Wolf hound = (Wolf) loc.getWorld().spawnEntity(loc, EntityType.WOLF); hound.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE, 1, (short) - 98789)); hou...
1
void addRecipe(ItemStack var1, Object ... var2) { String var3 = ""; int var4 = 0; int var5 = 0; int var6 = 0; if(var2[var4] instanceof String[]) { String[] var7 = (String[])((String[])var2[var4++]); for(int var8 = 0; var8 < var7.length; ++var8) { String var9 ...
9
private void destroyBonds() { if (bonds != null && !bonds.isEmpty()) { synchronized (bonds.getSynchronizationLock()) { for (Iterator it = bonds.iterator(); it.hasNext();) { ((RadialBond) it.next()).destroy(); } } } bonds.clear(); if (bends != null && !bends.isEmpty()) { synchronized (bends...
9
public void zoneEventOccurred(String eventZone, int eventType){ // If within the bounds of the text, go to the link if(eventType==ZoneEvents.ENTER && eventZone.equals("polygon")){ Gui.changeCursor(Cursor.HAND_CURSOR); } else if (eventType==ZoneEvents.CLICK && eventZone.equals("polygon")){ // Adde...
6
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
5
public static boolean containsFeet(Point f1){ for (int i = 0; i < PlatformManager.floors.size(); i++){ if (PlatformManager.floors.get(i).contains(f1) && PlatformManager.floorLevel.get(i) == GameManager.level){ return true; } } return false; }
3
private static void eliminarCliente() { boolean salir; Integer idCliente; char caracter; do { try { System.out.print( "Introduce el Id del cliente: "); idCliente = Integer.parseInt( scanner.nextLine()); System.out.print( "Deseas eliminar todas las cuentas en tiendas del cliente ...
3
public static void main(String[] args) { try { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File(ClassLoader.getSystemResource(runXMLAUTHORITY).getFile()); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConf...
6
private HubNode getBusOf (Device dev) throws IOException { Bus bus = dev.getBus (); for (int i = 0; i < busses.length; i++) { if (bus == busses [i]) return hubs [i]; } System.err.println ("what bus ??"); return null; }
2
public String getText() { StringBuffer sb = new StringBuffer(); try (BufferedInputStream in = new BufferedInputStream( new FileInputStream(new File(path)))) { int c; while ((c = in.read()) != -1) { sb.append((char) c); ...
2
public void activateEmbeddedMovie(boolean b) { if (b) { if (job != null && !job.contains(movieUpdater)) job.add(movieUpdater); int m = movieUpdater.getInterval(); modelTimeQueue.setInterval(m); kine.setInterval(m); pote.setInterval(m); tote.setInterval(m); int n = movie.getCapacity(); setQ...
9
private int nextChunk() throws IOException { int available = super.available(); // must always try to read 1 byte! // some buggy InputStreams return < 0! if (available <= 0) { available = 1; } if (available > inBuf.length) { ...
9
private static void addCollection(Collection<ATask> task){ Session session = HibernateUtil.getSessionFactory().openSession(); try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for(ATask o : task) session.save(...
4
public void csv(){ Grid g1 = hierarchyGrids.getGrid(1); GridNode[] n = g1.nodes; Map<Integer, Integer> ClustersFine = new HashMap<Integer, Integer>(); System.out.println(); System.out.println("F-POINTS:"); for(GridNode f : n){ if(f.type == NodeType.F){ System.out.print(f.id+1 + " "); } } Sy...
9
@Override public void save(ObjectOutput out) throws IOException { out.writeShort(ints.length); for(int i:ints){ out.writeInt(i); } out.writeShort(longs.length); for(long l:longs){ out.writeLong(l); } out.writeShort(floats.length); for(float f:floats){ out.writeFloat(f); } out.writeShort(do...
6
protected Object getParentElement(Object element) { boolean oldBusy = isBusy(); setBusy(true); try { if (contentProviderIsLazy && !contentProviderIsTreeBased && !(element instanceof TreePath)) { ILazyTreeContentProvider lazyTreeContentProvider = (ILazyTreeContentProvider) getContentProvider(); return l...
8
public CachedRowSetImpl executeQuery() throws SQLException { String sql = ""; CachedRowSetImpl crs = new CachedRowSetImpl(); if (isGetAll()) { sql = SELECT + getQueryBuilder().getSelectValue() + FROM + getQueryBuilder().getTableName() + ";"; try { getConnection(false); sqlStatement = getConn().prep...
5
public String toString() { return this.mode == 'd' ? this.writer.toString() : null; }
1
public ContactEntity getContact() { return contact; }
0
public javax.swing.JTable getTabla(){ return this.tabla; }
0
public final EsperParser.ifthenelse_return ifthenelse() throws RecognitionException { EsperParser.ifthenelse_return retval = new EsperParser.ifthenelse_return(); retval.start = input.LT(1); Object root_0 = null; Token ENDIF30=null; EsperParser.if__return if_27 =null; ...
7
public void showGroupMembers (String group, CommandSender sender) { ArrayList <String> players = new ArrayList <String> (); Player [] player = Bukkit.getServer().getOnlinePlayers(); for (int i = 0; i < player.length; i++) { if (config.getConfig().getString("Player."+player[i].getName()+".CR").equalsIgnoreCase(...
3
public MainController() { }
0
@Override protected void process(Entity e) { Position pos = rectplayermap.get(e); int height = container.getHeight(); int width = container.getWidth(); Input input = container.getInput(); // AXE VERTICAL { if (input.isKeyDown(Input.KEY_UP)) { if (pos.getY() - VELOCITE >= 0) { pos.setY(pos....
9
public Move getLastMove() { return this.moveList.size() > 0 ? this.moveList.get(this.moveList.size() - 1) : null; }
1
public static void main(String[] args) { // read class name from command line args or user input String name; if (args.length > 0) name = args[0]; else { Scanner in = new Scanner(System.in); System.out.println("Enter class name (e.g. java.util.Collections): "); ...
4
public static boolean checkKing() { if(player=="black") for(int y=0;y<7;y++) if(pieces[0][y]==-1) return true; else if(player=="white") for(int a=0; a<7; a++) if(pieces[7][a]==1) return true; return false; }
6
public LocalDate getEventLocalDate(int meetingsAway) { LocalDate thisMeeting = (weekOfMonth != LAST) ? now.with(TemporalAdjusters.dayOfWeekInMonth(weekOfMonth,dayOfWeek)) : now.with(TemporalAdjusters.lastInMonth(dayOfWeek)); // Has the meeting already happened this month? if (thisMeeting.isBefore(now)) { ...
3
public int[] getPos() { if(protons == 1) return new int[] {0, 0}; int thisRow = 0, thisCol = 0; boolean breakOut = false; for(int row = 0; row < periodicTable.length; row++) { for(int col = 0; col < periodicTable[0].length; col++) { if(periodicTable[row][col] == protons) { thisRow = ...
5
public void mainMenu() { int valg = -1; while(valg < 0 || valg > 5) { System.out.println("=========Logged in as " + user.getName() + "========="); startUpInvitations(); System.out.println("0: Log out"); System.out.println("1: Appointment manager"); System.out.println("2: Group management"); Sys...
8
public OptionsPanel(Frame parent) { super(parent); setModal(true); JPanel panel = new JPanel(new BorderLayout()); JLabel label = new JLabel("Настройки", 0); label.setBorder(new EmptyBorder(0, 0, 16, 0)); label.setFont(new Font("Default", 1, 16)); panel.add(label, "North"); JPanel op...
8
private void checkBurntState() { //used to make talking heads burn if (isOnFire() == false && !burned) { return; } if (burnedFeet == true) { burnedDontMove = true; return; } if (isOnFire() == true) { if (!cooked) { cookTimer = cookTimer + 1; //this is all used to trigger the bur...
8
private static void playerInventory() { System.out.println("Player Inventory"); for (int i = 0; i < playerInventory.length; ++i) { if (playerInventory[i] != null) { System.out.println(i + ":" + playerInventory[i]); } } }
2
private static void test_strdtoi(TestCase t) { // Print the name of the function to the log pw.printf("\nTesting %s:\n", t.name); // Run each test for this test case int score = 0; for (int i = 0; i < t.tests.length; i += 2) { int exp = (Integer) t.tests[i]; String arg1 = (String) t.tests[i + 1]; i...
2
private void moveP() { Player player = Main.getGamestate().getPlayer(); if (getY() < player.getY()) { move(0, 1); } else if (getY() > player.getY()) { move(0, -1); } else if (getX() < player.getX()) { move(1, 0); } else if (getX() > player.getX()) { move(-1, 0); } if (getX() == player.getX() &...
6
@Override protected void loadNBT(NBTTagCompound data) { super.loadNBT(data); NBTTagList tagList = new NBTTagList(); for (Map.Entry<WorldCoordinate, SignalAspect> entry : aspects.entrySet()) { NBTTagCompound nbt = new NBTTagCompound(); if (entry.getKey() != null && ent...
3
private boolean addOwnable(ChunkyObject o) { if (o == null) throw new IllegalArgumentException(); // If owner is a owned by the child, remove owner from tree first. // ex. town.setOwner(Peasant) Peasant is removed from parent (Town). if (this.isOwnedBy(o) && this.owner != n...
5
public Boolean ifExistAuditeur(Auditeur a) { for (int i =0; i<liste.size();i++){ Auditeur ai = liste.get(i); if (ai.getNom().equalsIgnoreCase(a.getNom()) && ai.getPrenom().equalsIgnoreCase(a.getPrenom())&& ai.getDateNaissance().equals(a.getDateNaissance())){ return true; } } ...
4
public static void checkRank(Player player) { int kills = player.getKillCount(); for (int i = 0; i < ranks.length; i++) { PkRank rank = ranks[i]; if (rank == null) break; if (rank.username.equalsIgnoreCase(player.getUsername())) { ranks[i] = new PkRank(player); sort(); return; } } fo...
7
private void redraw(Graphics g) { g.translate((int) dx, (int) dy); if (toBeDrawn == null) { if (action != null && action.equals("inventory")) GraphicsRenderer.drawInventory(g, Class_Examples.getChest()); else if (action != null && action.equals("drawRoom")) room.draw(g); } else g.drawImage(toBe...
5
public void flujoEntrada(){ String entra=""; String nickname_input=""; Integer tipo; DES objetoDES = new DES(this.clave); try { while(conectado){ //Leemos el Nickname //entra=(String) entrada.readObject(); //thi...
9
public FuseArgumentParser(String[] args) { boolean seenOption = false; for (String arg : args) { if (seenOption == true) { remaining.add(arg); seenOption = false; } else if ("-o".equals(arg)) { remaining.add(arg); s...
6
*/ public void nextActiveUnit(Tile tile) { if (!requireOurTurn()) return; // Always flush outstanding messages first. nextModelMessage(); //if (canvas.isShowingSubPanel()) { // canvas.getShowingSubPanel().requestFocus(); // return; //} // Flush...
9
public UnconditionalFlowInfo unconditionalFieldLessCopy() { // TODO (maxime) may consider leveraging null contribution verification as it is done in copy UnconditionalFlowInfo copy = new UnconditionalFlowInfo(); copy.tagBits = this.tagBits; copy.maxFieldCount = this.maxFieldCount; int limit = this.maxFieldCount; ...
9
public void update(int id, TravelTrip travelTrip){ TravelTrip travelTripTemp = findById(id); travelTripTemp.setCountry(travelTrip.getCountry()); travelTripTemp.setCity(travelTrip.getCity()); travelTripTemp.setFromDate(travelTrip.getFromDate()); travelTripTemp.setToDate(trav...
0
private void incrementTurn() { index++; for (int i = index;; i++) { index = i % numPlayers; if (players[index].isLiving()) break; } if (index == firstPlayerIndex) { updateRound(); round++; log("Beginning Round " + round); } playerPnlHash.get(activePlayer).setActive(false); activ...
5
private static int method516(char ac[], int j) { for (int k = j; k < ac.length && k >= 0; k++) if (ac[k] < '0' || ac[k] > '9') return k; return ac.length; }
4
public void setFunConsumoUltimoMes(Integer funConsumoUltimoMes) { this.funConsumoUltimoMes = funConsumoUltimoMes; }
0
public void DBUpdateRoomItem(String roomID, Item item) { if((roomID==null)||(!item.isSavable())||(item.amDestroyed())) return; synchronized(roomID.toUpperCase().intern()) { DBDeleteRoomItem(roomID,item); if(Log.debugChannelOn()&&(CMSecurity.isDebugging(CMSecurity.DbgFlag.CMROIT)||CMSecurity.isDebugging(...
9
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
5
void run(){ Scanner sc = new Scanner(System.in); for(;;){ h = sc.nextInt(); w = sc.nextInt(); if((h|w)==0)break; m = new int[h][w]; dist = new int[h][w]; dir = new int[100]; for(int i=0;i<h;i++)for(int j=0;j<w;j++){ m[i][j] = sc.nextInt(); if(m[i][j]==0)c++; if(m[i][j]==2){ ai = i...
9
public void Solve() { int[] initialArray = new int[10]; for (int i = 0; i < 10; i++) { initialArray[i] = i; } List<int[]> pandigitalNumbers = Enumerate(initialArray, 0); long sum = 0; int[] divisors = new int[]{2, 3, 5, 7, 11, 13, 17}; for (Iterator<...
6
public void visitIntInsn(final int opcode, final int operand) { buf.setLength(0); buf.append(tab2) .append(OPCODES[opcode]) .append(' ') .append(opcode == Opcodes.NEWARRAY ? TYPES[operand] : Integer .toString(operand)).append('\n'); text.add(buf.toString()); if (mv != null) { mv.visitIntIn...
2
@SuppressWarnings({ "rawtypes", "unchecked" }) private <K> BeanEvent<K> updateBeanEvents(Class<?> beanClass, Class<K> listener) { BeanEvent result = null; try { for (EventSetDescriptor ed : Introspector.getBeanInfo(beanClass) .getEventSetDescriptors()) { BeanEvent be = new BeanEvent(ed); event...
5
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed // TODO add your handling code here: String str2; DefaultListModel md = new DefaultListModel(); str2 = this.jTextField9.getText().toUpperCase(); if(Biblio.containsKey(...
2
@Override public boolean liiku(Ruutu kohde) { Ruutu ohestalyotava = null; if (this.ruutu.getSijainti().xMuutos(kohde.getSijainti()) != 0 && kohde.getNappula() == null) { ohestalyotava = lauta.getRuutu(kohde.getSijainti().getX(), this.ruutu.getSijainti().getY()); } int vuo...
9
@Override protected EncryptionKey send(final String sessionId, final String orderId, final PaymentForm form, final CommodityDetail[] commodityDetail) throws NoSuchAlgorithmException { log.info("POST送信開始"); try { // AIRWEBはクライアント証明書を配布しない HttpsURLConnection.setDefa...
9
private boolean jj_3R_41() { if (jj_scan_token(WHILE)) return true; if (jj_3R_50()) return true; if (jj_scan_token(DO)) return true; return false; }
3
public Site getAdjByTag(Site site, SiteTag tag) { int x = site.x; int y = site.y; switch (tag) { case NORTH: y--; break; case EAST: x++; break; case SOUTH: y++; break; case WEST: x--; break; } if (this instanceof TorusSpace) { x = x % width; y = y % height; return getSite(x, y); } else { ...
9
public boolean checkLoan(Loan l, final Inventory i) { Borrower bwer = l.getBorrower(); Period period = l.getPeriod(); Equipment stuff = i.findAvailableEquipment(l.getModel()); final int LOAN_DURATION_LIMIT; final int LOAN_RESERVATION_LIMIT; // Checks if the loan is valid...
4
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "RecipientKeyInfo", scope = AgreementMethodType.class) public JAXBElement<KeyInfoType> createAgreementMethodTypeRecipientKeyInfo(KeyInfoType value) { return new JAXBElement<KeyInfoType>(_AgreementMethodTypeRecipientKeyInfo_QNAME, KeyInf...
0
final void method3643(Canvas canvas, int i, int i_195_) { do { try { anInt7955++; if (canvas == ((NativeToolkit) this).aCanvas7925) throw new RuntimeException(); if (aHashtable8014.containsKey(canvas)) break; if (!canvas.isShowing()) throw new RuntimeException(); try { Class var_...
8
public void registerMany(Kim kim) { int length = kim.length; int limit = this.capacity - this.length; if (limit > JSONzip.substringLimit) { limit = JSONzip.substringLimit; } int until = length - (JSONzip.minSubstringLength - 1); for (int from = 0; from < until...
9
public synchronized void gridletPause(int gridletId, int userId, boolean ack) { boolean status = false; // find this Gridlet in the execution list int found = gridletInExecList_.indexOf(gridletId, userId); if (found >= 0) { // update Gridlets in execution list up...
3
private boolean AvoidGrenade(Info info){ for(int i=0;i<info.getEnemies().size();i++){ double angle = 0; int e_x = info.getX(); int e_y = info.getY(); int my_x = info.getEnemies().get(i).getX(); int my_y = info.getEnemies().get(i).getY(); ...
6
@Override public void initialize(String filePath){ patternEncoderUtil = new PatternEncoderUtil(); try { setUtil(patternEncoderUtil); analyzePattern(new FileReader(filePath)); } catch (FileNotFoundException e) { e.printStackTrace(); } try { ...
2
private int sendClearCommand() throws Exception { int c; ArrayList<Integer> answer = new ArrayList(); this.output.flush(); Thread.sleep(this.MAX_INTERVAL * 10); this.output.write((char)Sign.REQUEST); this.output.flush(); Thread.sleep(this.MAX_INTERVAL * 3);...
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TNode<T> tNode = (TNode<T>) o; if (center != tNode.center) return false; if (character != tNode.character) return false; if (left != tNode.left) return false; if (right != ...
8
public static void main(String args[]) throws Exception { try { //int depth=Integer.parseInt(args[2]); int depth=3; FileReader in = new FileReader(args[0]); BufferedReader br = new BufferedReader(in); String test=br.readLine(); FileWriter out = new FileWriter(args[1]); BufferedWriter write = new Bu...
9
private void verificarSeleccionParametricasTransformador() { if (puntoLuz.getTransformador().getTipoTransformador().getId() == null) { puntoLuz.getTransformador().setTipoTransformador(null); } if (puntoLuz.getTransformador().getFabricante().getId() == 0) { puntoLuz.getTr...
8
@Override public void buildFinished(SRunningBuild build) { super.buildFinished(build); if( !build.isPersonal() && build.getBuildStatus().isSuccessful() && slackConfig.postSuccessful() ) { processSuccessfulBuild(build); } else if ( !build.isPersonal() && build.get...
6
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 List<List<LngLatAlt>> getInteriorRings() { assertExteriorRing(); return coordinates.subList(1, coordinates.size()); }
0
protected void processClauseGraphFragments(List<GraphFragment> matchPhraseList) throws InformationProblem { int matchPhraseCount = 0; for (GraphFragment matchPhrase : matchPhraseList) { if (matchPhraseCount > 0) { _strBuf.append(", "); } List<List<GraphComponent>> matchPhraseGraphComponentList ...
7
byte[] getPngData(Image img) { int imageType = artwork.hasAlpha() ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB; // FIXME: Wouldn't it be better to use a BufferedImage and avoid this anyway? BufferedImage bi = new BufferedImage(img.getWidth(null), img.getHeight(null), imageType); Graphics bg = bi....
2
public int getX() { if(this == RIGHT) return 1; if(this == LEFT) return -1; return 0; }
2
public int getCount(int number){ if(number > 3){ for(int i=3 ; i < number ; i++){ for(int j=2 ; j < i ; j++){ count ++; if(i%j == 0){ break; } count--; } } number -= (count+2); System.out.println(number); return n...
5
public boolean chequearQuery(String sql) { boolean resultado = false; int indice = sql.indexOf(' '); String tipo = sql.substring(0, indice).toLowerCase(); if (tipo.equals("select") || tipo.equals("insert") || tipo.equals("update") || tipo.equals("delete")) resultado = true; return resultado; }
4
private ResolvedGenericType resolveSuper(Type genericSuperType) { if (genericSuperType instanceof Class) { return new ResolvedGenericType((Class<?>)genericSuperType, new Class<?>[0]); } else if (genericSuperType instanceof ParameterizedType) { TypeVariable<?>[] typeParameters = getRawType().getTypeParameters(...
9
@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 Employee)) { return false; } Employee other = (Employee) object; if ((this.id == null && other.id != null) || (...
5
@Override public <T extends Event> void event(final T event) { for (Class<? extends Event> cls : core.getClasses()) { if (cls.isInstance(event)) { for (@SuppressWarnings("rawtypes") final ControllerListener listener : core.getListeners(cls)) { Runnable r = new Runnable() { @SuppressWarnings("un...
5
@SuppressWarnings("unchecked") void readRegulationTrack(String regTrack) { //--- // Read file //--- if (verbose) Timer.showStdErr("Reading regulation track '" + regTrack + "'"); String regFile = config.getDirDataVersion() + "/regulation_" + regTrack + ".bin"; ArrayList<Regulation> regulation = (ArrayList<R...
6
@Test public void testInfixToPostfix2() throws DAIllegalArgumentException, DAIndexOutOfBoundsException, ShouldNotBeHereException, BadNextValueException, UnmatchingParenthesisException { try { infix.addLast("*"); infix.addLast("5"); QueueInterface<String> postFix = calc.infixToPostfix(infix); String...
5
public Vector<LogicalJoinNode> orderJoins( HashMap<String, TableStats> stats, HashMap<String, Double> filterSelectivities, boolean explain) throws ParsingException { // See the project writeup for some hints as to how this function // should work. // some co...
8
@Override public void initializeNorm() { checkingNorms(); for ( Action action : getAllActions().values() ) { if ( action.getNormType() != null ) // Only action linked with deontic concept will goona be setted { if ( action.getNormType() == NormType.OBLIGATION ) { if ( getPlayer().containAct...
9
public boolean canAttack(Unit enemy) { return enemy != null && enemy.getHP() > 0 && team != enemy.getTEAM() && inRange(enemy) && attacking; }
4
public static int findSmallestDiff(int[] a) { if (a.length < 2) return -1; int diff = (int)Math.abs(a[0] - a[1]); for (int i = 0; i < a.length; i++) for (int j = i + 1; j < a.length; j++) { int tmp_diff = Math.abs(a[i] - a[j]); if (tmp_diff < diff) diff = tmp_diff; } ...
4
@EventHandler public void SkeletonRegeneration(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.getZombieConfig().getDouble("Skeleto...
7
public void update(Game game) { actions.clear(); //passive moment. super.updatePassive(); //Get the closest targets closestTargets(game); Direction act = Types.DNONE; if(targets.size() > 0) { //If there's a target, get the path to it and...
3
@Override protected void mutate(Individual i) { Expression e = (Expression) i; Random r = new Random(); if (e.isLeaf()) { ((Leaf) e).rebuild(); return; }// else int d = r.nextInt(e.depth()); int current = 0; int choosen = 0; Expression[] exps = null; while (current < d && !e.isLeaf()) { exps...
4
private <T extends Fetcher> void doFetcher(Collection<T> fs, Map<String, Integer> ignored, Map<String, Integer> offered) throws InterruptedException { for (Fetcher fetcher : fs) { String fetcherKey = fetcher.getClass().getName(); if (fetcher.isIgnore()) { this.getLogger().debug( "ignore fetch...
5