text
stringlengths
14
410k
label
int32
0
9
public boolean equals(Object object) { if (! (object instanceof CycConstant)) return false; Guid thisGuid = getGuid(); Guid thatGuid = ((CycConstant) object).getGuid(); return thisGuid.equals(thatGuid); }
1
@Override public void execute() { MahTreez.status = "Chopping"; SceneObject tree = SceneEntities.getNearest(MahTreez.activeTree.getIds()); if (tree == null) { System.out.println("Chop: cannot find the tree! Camera rotation (for next tree)."); if (Random.nextInt(1, 3) == 1) { Camera.setAngle(Camera.get...
5
protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException { out.writeStartElement(getXMLElementTagName()); out.writeAttribute(ID_ATTRIBUTE, getId()); if (destination != null) { out.writeAttribute("destination", destination.getId()); } out.writeAttribu...
6
public static boolean phone(String phone){ if(phone.matches("(\\d){10}")) return true; return false; }
1
private final void method3914(byte i) { anInt7922++; anInterface5_Impl1_8201 = method3889(false, 16711680); if (i <= -97) { anInterface5_Impl1_8201.method20(3096, (byte) 126, 12); for (int i_225_ = 0; i_225_ < 4; i_225_++) { Buffer buffer = anInterface5_Impl1_8201.method19(true, 26775); if (buffer != n...
6
public ControllerCrlv(ViewCrlv tela, ModelCRLV c, ViewGerenciarCrlvs g) { jifCrlv = tela; daoCrlv = new DAOCrlv(); gcrlv = g; if(c == null) crlv = new ModelCRLV(); else{ crlv = c; jifCrlv.setModelCrlv(crlv); } ...
1
public void updateCellData(String key, String value) { if (jt_language.getSelectedRow() != -1) { row = jt_language.getSelectedRow(); } // System.out.println(row); cellData[row][0] = key; cellData[row][1] = value; prop.put(key, value); }
1
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); response.setHeader("Edge-control", "no-store"); if ("clear".equalsIgnoreCase(request.getParameter("clear"))) { ...
9
public int inserir (Usuario us){ Connection conn = null; PreparedStatement pstm = null; int retorno = -1; try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS); pstm.setString(1, us.getNome...
3
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); int t = 1; while ((line = in.readLine()) != null && line.length() != 0) { int times = Integer.parseInt(line); f...
3
public static String valorMonetario(String valor) { int pontos = -1; valor = valor.replaceAll(",", "."); valor = valor.replace("..", "."); for (int i = 0; i < valor.length(); i++) { if (valor.charAt(i) == '.') { pontos++; } } if (!...
9
public void start() { if (!this.socket.isBound()) { throw new IllegalStateException("Can't start ConnectionHandler " + "without a bound socket!"); } this.stop = false; if (this.thread == null || !this.thread.isAlive()) { this.thread = new Thread(this); this.thread.setName("bt-serve"); this.th...
3
private void trimTexts(Field field, Object prop) { if(prop instanceof JTextComponent) { JTextComponent txtComp=(JTextComponent)prop; Trim trim=field.getAnnotation(Trim.class); if(trim!=null) { if(trim.value()==YesNo.YES) { txtComp.setText(txtComp.getText()==null?null:txtComp.getText().trim()); ...
6
public void loadCardConfigFile(String file) throws FileNotFoundException, BadConfigFormatException { FileReader cardReader = new FileReader(file); Scanner cardScanner = new Scanner(cardReader); Card toAdd; final int numColumns = 2; String name; Card.cardType type = null; while(cardScanner.hasNextLine()) {...
5
public void returnOperation( final AbstractInsnNode insn, final Value value, final Value expected) throws AnalyzerException { if (!isSubTypeOf(value, expected)) { throw new AnalyzerException(insn, "Incompatible return type", expecte...
1
public String toString(){ StringBuffer map = new StringBuffer( ); //goes through all the rooms and appends -[ ]- //if there are any people in the room, it cuts out a space and adds the first letter of their names. for(int y=0; y<worldHeight; y++){ for(int x=0; x<worldWidth...
5
@Override public void setPystyNopeus(double pystyNopeus){ for (KentallaOlija osa : osat){ osa.setPystyNopeus(pystyNopeus); } }
1
@Test public void testBothWays() throws IOException, InterruptedException { for(File org : testdataDirectory.listFiles()) { if(org.isFile()) { System.out.println("checking " + org.getName()); byte[] originalData = TestUtil.readFully(org); ByteArrayOutputStream compressedData = new ByteArrayOutpu...
2
private void eol() throws XMLStreamException { mWriter.writeCharacters("\n"); //$NON-NLS-1$ for (int i = 0; i < mDepth; i++) { mWriter.writeCharacters(mIndent); } }
1
@Override public void createPossibleMoves() { possibleMoves = new ArrayList<Square>(); //direction boolean is set to false if a piece is blocking the direction boolean nw = true, ne = true, sw = true, se = true; for(int i = 1; i < ChessEngine.SQUARE_HEIGHT; i++) { //if no more squares can be valid, bre...
9
protected void scanDirectory(File dir) { boolean ok = true; File[] files = ( fileFilter != null ? dir.listFiles(fileFilter) : dir.listFiles() ); // Process all the FILES first for (int i = 0; i < files.length && ok; i++) { ...
9
public List<String> listIpAddress(String id) throws Exception { String response = getServer(id); if (containsErrorMessage(response)) { throw new Exception("Error retrieving ip address for instance id:" + id); } Document doc = stringToXmlDocument(response); NodeList list = doc.getElementsByTagName("ip...
2
void updateTable() { table.getItems().setAll(select()); }
0
public String toLowerThis(String input){ MethodReferenceSAM methodReferenceSAM = this::toLowerCase; return methodReferenceSAM.process(input); }
0
@Override public void executeMsg(Environmental affecting, CMMsg msg) { super.executeMsg(affecting,msg); final MOB source=msg.source(); if(!canFreelyBehaveNormal(affecting)) return; final MOB observer=(MOB)affecting; if((source!=observer) &&(msg.amITarget(observer)) &&(msg.targetMinor()==CMMsg.TYP_GI...
7
public void execute() { Process pro; try { pro = Runtime.getRuntime().exec("javac " + mapperClass + ".java"); // compile pro.waitFor(); Class<?> myClass = Class.forName(mapperClass); Class<?>[] paramsClass = new Class<?>[2]; paramsClass[0] = String.class; paramsClass[1] = Output.class; ...
6
public Node<T> getNode(T value) { if (value == null) { return null; } Node<T> node = root; while (node != null) { int delta = compare(node.getValue(), value); if (delta < 0) { node = node.getRight(); } else if (delta > 0) { node = node.getLeft(); } else { ...
4
public GenKTR(Simulation simulation){ //Récupération de variables nécessaires à l'élaboration du fichier de sortie int hyperperiode = simulation.getHyperperiode(); //Ouverture d'un flux d'écriture String StringBuilder result = new StringBuilder(); //Définition de la précision result.append(KIWI_INSTR...
4
public void ReadFile() { JSONParser jsonParser = new JSONParser(); try { FileReader json = new FileReader("src/config.json"); Object obj = jsonParser.parse(json); JSONObject jsonObject = (JSONObject) obj; setHost((String) jsonObject.get("host")); setPort((String) jsonObject.get("port")); setUse...
4
public static void main(String[] args) throws IOException, ParseException { // 0. Specify the analyzer for tokenizing text. // The same analyzer should be used for indexing and searching StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_40); // 1. create the index Directory index =...
2
private String getTextAsEps(String text) { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < text.length(); i++) { final char c = text.charAt(i); if (c == '\\') { sb.append("\\\\"); } else if (c == '(') { sb.append("\\("); } else if (c == ')') { sb.append("\\)"); } else if...
9
public static SpriteStore get() { if (instance == null) { instance = new SpriteStore(); } return instance; }
1
@Override public byte[] runBinaryMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) throws HTTPServerException { final MIMEType mimeType = MIMEType.All.getMIMEType(getFilename(httpReq,"")); if(mimeType != null) httpResp.setHeader("Content-Type", mimeType.getType()); final String last=httpReq.getU...
7
@Override public void onEnable() { getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { { // CraftBukkit-specific Configuration bukkitYML = new Configuration( new File("bukkit.yml")); bukkitYML.load(); List<String> worlds = ...
5
Tree makeList() { Tree myleft, myright; Tree tleft,tright; Tree retval = this; // head of left list if (left != null) myleft = left.makeList(); else myleft = null; // head of right list if (right != null) myright = right.makeList(); else myright = nu...
5
private ArrayList buildPredicates() throws Exception { ArrayList predicates = new ArrayList(); /* The result. */ Predicate predicate; Attribute attr; Enumeration attributes = m_instances.enumerateAttributes(); boolean individual = (m_parts != null); /* Individual-based learning ? */ /* Attribu...
8
@Override public void notifyObservers() { for (Observer observer : observers) { observer.update(temperature, humidity, pressure); } }
1
private void updateLinks(){ Link l = null; for(Node source:nodes){ for(Node dest:nodes){ if(source.getName().equals(dest.getName())){ continue; // same node } l = getLink(source,dest); if(l==null){ continue; //nodes arent neighbours } //if link has been ta...
7
private static boolean isEmpty(int r, int t) { if (r < 15 && t < 15 && r >= 0 && t >= 0){ String täht = Mang.MangulaudMassiiv[r][t]; return täht.equalsIgnoreCase(" ") || täht.equalsIgnoreCase("") || täht.equalsIgnoreCase("3xs") || täht.equalsIgnoreCase("2xs") || täht.equalsIgnoreCase("3xt") ...
9
public ITable getTable() { return _table; }
0
@Override public boolean insertAlbum(Album album) { AlbumXML albumXML = new AlbumXML(); int lastAlbumID = 0; try { CDOrganizer cdOrganizer = XmlDAOFactory.unmarschallFile(); for (ArtistXML a : cdOrganizer.getArtistList()) { if (a.getID() == album.getArtist().getId()) { if ( a.getAlb...
6
@Override protected void setup() { if (createdByJADE) { Object[] args = getArguments(); if (args != null && args.length > 0) { String first = args[0].toString(); if (first.equals("full")) { int numberOfRequests = args.length/3; if (args.length%3 == 1) { for (int i =...
8
private void showHelp(CommandSender sender) { StringBuilder user = new StringBuilder(); StringBuilder admin = new StringBuilder(); for (Command cmd : commands.values()) { CommandInfo info = cmd.getClass().getAnnotation(CommandInfo.class); if(!PermHandler.hasPerm(sender, ...
4
static void createFiles() { try { boolean success = new File("data" + File.separator + "logins-db").mkdirs(); // make directory if (success) { Server.display("Created directory: data" + File.separator + "logins-db"); } else { // File already ex...
8
public String decodeText(String _text) { // Obfuscated code will return by using StringBuilder; StringBuilder sb = new StringBuilder(); // Change text to Char array. char ch[] = _text.toCharArray(); // Make String array per 1 character from ch[]. // This String array uses to check key character and etc. ...
6
void add(String value, DefaultListModel valuesLM, JList jList) { if ((value == null) || (value.length() == 0)) { return; } int i = 0; for (Enumeration<?> e = valuesLM.elements(); e.hasMoreElements(); i++) { String s = (String)e.nextElement(); ...
7
public RuleDefinitionInterface getRuleDefinition(URL defnFile) throws Exception { RuleDefinitionInterface ruleDefi=(RuleDefinitionInterface)Factory.getFactory().getDataObject(Factory.ObjectTypes.RuleDefinition); Document doc=getDocument(defnFile.openStream()); NodeList ruleSets=doc.getElementsByTagName("rulesets"...
6
public void setNext(Items next) { this.next = next; }
0
public void updateEntity() { this.lastProgress = this.progress; if(this.lastProgress >= 1.0F) { this.func_31010_a(1.0F, 0.25F); this.worldObj.removeBlockTileEntity(this.xCoord, this.yCoord, this.zCoord); this.invalidate(); if(this.worldObj.getBlockId(this.xCoord, this.yCo...
4
@Override public void endDocument () {}
0
public static boolean intersects(Polygon obj, Polygon gridBoundary) { Line2D[] objLines = new Line2D[obj.npoints]; Line2D[] gridLines = new Line2D[gridBoundary.npoints]; objLines[0] = new Line2D.Double(obj.xpoints[0], obj.ypoints[0] + 1, obj.xpoints[1] + 1, obj.ypoints[1]); objLines[1] = new Line2D.Double...
4
public static void main(String[] args) { double d = 3.5; int i = (int)d; System.out.println(i); }
0
public void dispose() { if (this.soundtrack != null) { soundtrack.dispose(); } for (Sound sound : sounds) { sound.dispose(); } // this.manager.unload("music/soundtrack.ogg"); }
2
@Override public void improveSolution(Board board) { // handle black cells outer: while (board.getCount(CellColor.BLACK) < board.getSolutionBlackCount()) { for (final Set<Cell> group : board.getGroups(CellColor.BLACK)) { if (tryExpand(board, group, CellColor.BLACK)) { // we need to sta...
8
@Override public void deserialize(Buffer buf) { firstNameId = buf.readShort(); if (firstNameId < 0) throw new RuntimeException("Forbidden value on firstNameId = " + firstNameId + ", it doesn't respect the following condition : firstNameId < 0"); lastNameId = buf.readShort(); ...
7
public void open() { // Create the dialog window Shell shell = new Shell(getParent(), getStyle()); //Creates a shell object shell.setText(getText()); //Sets the shell text to the return of getText shell.setSize(WIDTH, HEIGHT); //Sets the size createContents(shell); //Calls create contents shell.open(); //Op...
2
public Enter(String title) { super(title); this.setLayout(new BorderLayout()); buttonList = new ButtonList(); tabs = new TabPane(); Container contentPane = getContentPane(); contentPane.add(buttonList,BorderLayout.NORTH); contentPane.add(tabs,BorderLayout.CENTER);...
0
public boolean predictFromKBestList(GuideDecision decision) throws MaltChainedException { if (decision instanceof SingleDecision) { throw new GuideException("A sequantial decision model expect a sequence of decisions, not a single decision. "); } boolean success = false; final SingleDecision singleDecisio...
8
public Detalle(int idDetalle, Encargo encargo, Producto producto, String otro, double precio, int cantidad, String color) { this.idDetalle = idDetalle; this.encargo = encargo; this.producto = producto; this.otro = otro; this.precio = precio; this.cantidad = cantidad; ...
0
public static void main(String[] args) { Random rand = new Random(); Integer[] states; double[] distributionTheorique; AlgorithmMCMC<Integer> algo; MarkovChain mc; double[] distributionExperimentale; final int ITERATION = 100; double pourcentages = 0; ...
4
@Override public void mouseReleased(MouseEvent e) { for (Button b : buttons) { if (e.getPoint().x > b.p.x && e.getPoint().x < b.p.x + b.d.width && e.getPoint().y > b.p.y && e.getPoint().y < b.p.y + b.d.height) { if(e.getButton() == 1){ b.left.run(); } else if(e.getButton() == 3){ b.right.run(); ...
7
public static String computeXpath (Node node) { String Xpath = localXpath(node); if ("" == Xpath) { return Xpath; } else { Node parent = node.getParentNode(); String moreXpath; while (null != parent.getLocalName()) { moreXp...
2
public boolean equals(Phasor a){ boolean test = false; if(this.isNaN() && a.isNaN()){ test=true; } else{ if(this.magnitude == a.magnitude && this.phaseInDeg == a.phaseInDeg)test = true; } ...
4
private void set(String d, String in) { if (d.equals(MovieColumn.LANGUAGE)) { language = in; } else if (d.equals(MovieColumn.MOVIE_ID)) { movie_id = in; } else if (d.equals(MovieColumn.MOVIE_NAME)) { movie_name = in; } else if (...
8
public void printList(){ System.out.println("Name: " + this.name + ", Age: " + this.age + ", Illness: " + this.illness); if (nextPatient != null){ nextPatient.printList(); } }
1
static private int jjMoveStringLiteralDfa8_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(6, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(7, active0); return 8; } switch(curChar) { cas...
5
protected String format(ProtectionDomain pd, Permission... perms) { final CodeSource cs = pd.getCodeSource(); if (null == cs) { return null; } final URL url = cs.getLocation(); if (null == url) { return null; } final StringBuilder sb = ne...
3
public static int findClosingParenIteratively(String s, int startingParenLoc) { // check for valid parens location int openParenCounter = 1; int returnVal = -1; if (errorCheck(s, startingParenLoc)) return -1; for (int i = startingParenLoc + 1; i < s.length(); i++) { if (s.charAt(i) == '(') { open...
5
public int firstIndexOf(int datum) { for (int i = 0; i < size; i++) { if (data[i] == datum) { return i; } } return -1; }
2
public static SqlMod updateSql(Model model) { List<Object> params = new ArrayList<Object>(); String tableName = tableName(model); List<Field> fields = fields(model); List<String> _fields = new ArrayList<String>(); Serializable idVal = 0; String idName = null; for (Field f : fields) { Id id = f.getAnnot...
8
public int solution(final int[] sizes, final int[] directions) { final Deque<Fish> stack = new LinkedList<Fish>(); final int N = sizes.length; for (int i = 0; i < N; i++) { final Fish downstreamFish = new Fish(sizes[i], directions[i]); while (!stack....
7
@Override public boolean equals(Object other) { boolean result = false; if (other instanceof RouteLeg) { RouteLeg that = (RouteLeg) other; result = this.startNode == that.startNode && this.endNode == that.endNode; } return result; }
2
@Override public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception { String cmd = splitted[0]; MapleCharacter pl = c.getPlayer(); if (cmd.equalsIgnoreCase("donated")) { if (splitted.length != 4) { pl.dropMessage("syntax : !donated...
9
@Override public void evaluate(final Population a_chromosomes) { double curFitness; final Iterator itChromosomes = a_chromosomes.iterator(); IChromosome chromosome; while (itChromosomes.hasNext()) { chromosome = (IChromosome) itChromosomes.next(); curFitness...
2
public static void play(Resource res, boolean loop) { synchronized(Music.class) { if(player != null) player.interrupt(); if(res != null) { player = new Player(res, player); player.loop = loop; player.start(); } } }
2
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { config = plugin.getConfig(); if (args.length == 0){ if (sender instanceof Player) { if (commandLabel.equalsIgnoreCase("winner")) { Player player = Bukkit.getServer().getPlayer(args[0]); Bukkit.getServe...
3
public void removeListener (Listener listener) { if (listener == null) throw new IllegalArgumentException("listener cannot be null."); synchronized (listenerLock) { Listener[] listeners = this.listeners; int n = listeners.length; if (n == 0) return; Listener[] newListeners = new Listener[n - 1]; for ...
6
public void saveCape(SpoutPlayer player) { File saveFile = new File(getDataFolder(), "saved.yml"); if (!saveFile.exists()) { try { saveFile.createNewFile(); } catch (IOException ex) { Logger.getLogger(PlayerPlus.class.getName()).log(Level.SEVERE, null, ex); } } YamlConfiguration yFile = YamlCo...
3
@Override public boolean confirmOrder(ArrayList<Product> order) { //Verify for (Product p : order) { if (!dbHandler.verifyInventory(p.getId(), -p.getInCurrentCart())) { return false; } } //Change inventory for (Product p : order) { dbHandler.addInventory(p.getId(), -p.getInCurrentCart()); }...
3
public void visit_invokeinterface(final Instruction inst) { final MemberRef method = (MemberRef) inst.operand(); final Type type = method.nameAndType().type(); stackHeight -= type.stackHeight() + 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += type.returnType().st...
1
public static World createWorld(int width, int height) { stoneBoundary = height - 2*(height/3); dirtBoundary = height - 2*(height/3) - height/12; blockSheet = new int[width][height]; createStone(width, height); createDirt(width, height); createTrees(width, height); FacilityGenerator.createFacility(b...
0
public int MovePacket(int inputBufferNumber, int outputBufferNumber, int TIME) { //ONLY ONE BUS PRESENT IN THIS FABRIC //if Active status was successful and the flag is true for having //control of the bus //set packet moved default packetMoved = false; ...
4
@Override public void generateChunk(InitialBlocks chunk, int chunkX, int chunkZ) { //EC: use the one passed in instead //int chunkX = chunk.getX(); //int chunkZ = chunk.getZ(); for(int x=0; x<16; x++) { for(int z=0; z<16; z++) { int trueX = chunkX*16+x; int trueZ = chunkZ*16+z; chunk.setBloc...
9
private static CtClass findCommonSuperClass(CtClass one, CtClass two) throws NotFoundException { CtClass deep = one; CtClass shallow = two; CtClass backupShallow = shallow; CtClass backupDeep = deep; // Phase 1 - Find the deepest hierarchy, set deep and shallow correctly ...
8
public boolean hasLocationpath(String xpathExpression){ if (xpathExpression.contains("/")){ return true; }else{ return false; } }
1
public void open(Player player) { Inventory inventory = Bukkit.createInventory(player, size, name); for (int i = 0; i < optionIcons.length; i++) { if (optionIcons[i] != null) { inventory.setItem(i, optionIcons[i]); } } player.openInventory(inventor...
2
public boolean canScroll(Direction scrollDirection) { Point robot = model.getRobotLocation(); int topBorder = Math.abs(panel.getScroll()); int bottomBorder = Math.abs(panel.getScroll()) + panel.getHeight(); switch(scrollDirection) { case DOWN: return robot.y <= (topBorder + 50); case UP: return robot....
2
public Coordinate setAIMove() throws IndexOutOfBoundsException, InterruptedException { boolean test = false; if (test || m_test) { System.out.println("OthelloAI :: setAIMove() BEGIN"); } ArrayList<Coordinate> listTwo = new ArrayList<Coordinate>(); listTwo = getAvailableMoves(); in...
9
public void deleteFile() { String dirPath = "resources/files/RecipeData/" + recipeID + ".json"; File currFile = new File(dirPath + recipeID + ".json"); if (!currFile.exists()) { return; //there is nothing to delete } String jsonString = ""; //the json String representation of the last File RecipeData ...
6
public double rawStandardDeviationCorrelationCoefficients(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients(); return this.rawStandardDeviationRhoWithoutTotals; }
2
public ArrayList<Geometry> calculate(ArrayList<Residue> residueList) { ArrayList<Geometry> geoArray = new ArrayList<Geometry>(); for (int i = 0; i < residueList.size() - 5; i += 2) { if (!residueList.get(i).getSS().equals("T") && !residueList.get(i+4).getSS().equals("T") && !residueList.get(i+1).getSS().e...
9
public static void createOpponentCardInfo(ItemStack item, Card c) { if(MonsterCard.class.isInstance(c)) { MonsterCard mc = MonsterCard.class.cast(c); if(mc.faceup) Duelist.createCardInfo(item, c); else { Main.setItemName(item, "?"); Main.giveLore(item, 4); Main.setItemData(item, 0, "[Monster]...
6
void setObjectAlreadyInDB(boolean objectAlreadyInDB) { this.objectAlreadyInDB = objectAlreadyInDB; }//setObjectAlreadyInDB
0
public void testBinaryCycAccess10() { System.out.println("\n**** testBinaryCycAccess 10 ****"); CycAccess cycAccess = null; try { try { if (connectionMode == LOCAL_CYC_CONNECTION) { cycAccess = new CycAccess(testHostName, testBasePort); } else if (connectionMode == SOAP_CYC_...
4
@Test public void selectLocationTest() { System.out.println(board.getPlayers().size()); ComputerPlayer player = (ComputerPlayer)board.getPlayers().get(0); // Pick a location with no rooms in target, just three targets board.calcTargets(board.calcIndex(3, 3),2); int loc1 = 0; int loc2 = 0; int loc3 = 0; ...
9
public static GoHomeAndSleepTillRested getSingleton(){ // needed because once there is singleton available no need to acquire // monitor again & again as it is costly if(singleton==null) { synchronized(GoHomeAndSleepTillRested.class){ // this is needed if two threads are waiting at ...
2
**/ private void exciteVerticalSameShapeRecognizers(int shape) { int shapeOffset = 2500 * shape; double weight = 0.3; for (int neuron = 0; neuron < 2500; neuron++) { if (neuron % 5 != 0) {// not the inhibitory ones int toNeuron; int fromNeuron = neuron + shapeOffset; int from...
7
public DisplayMode[] getCompatibleDisplayModes() { return device.getDisplayModes(); }
0
public void renderElementalCircle(int xp, int yp, Element e, int phase) { int col = 0; Sprite sprite = Sprite.elementalCircle[phase]; switch (e) { case FIRE: { col = 0xffE5554C; break; } case WATER: { col = 0xff4C70E5; break; } case EARTH: { col = 0xff82E54C; break; } case WIND: { col = 0xffE5E5E5; bre...
9
private void checkForRotation(){ double tangent = (this.highYaxisXpixel - this.lowYaxisXpixel)/(this.highYaxisYpixel - this.lowYaxisYpixel); this.angleYaxis = Math.toDegrees(Math.atan(tangent)); tangent = (this.lowXaxisYpixel - this.highXaxisYpixel)/(this.highXaxisXpixel - this.lowXaxisXpixel); ...
2