text
stringlengths
14
410k
label
int32
0
9
public static OperationStrategy getStrategy(String operator){ if("+".equals(operator)){ return new AdditionOperationStrategy(); }else if("-".equals(operator)){ return new SubtractionOperationStrategy(); }else if("*".equals(operator)){ return new MultiplyOperationStrategy(); }else if("/".equals(opera...
4
AbstractNode expr() { AbstractNode node = simpleExpr(); if (test(EQ)) { read(EQ, "="); node = new BinOpNode(EQ_OP, node, simpleExpr()); } else if (test(NEQ)) { read(NEQ, "#"); node = new BinOpNode(NEQ_OP, node, simpleExpr()); } else if (test(LO)) { read(LO, "<"); node = new BinOpNode(LO_OP, n...
6
public void writeReview(String id) { // Create a new rno for the review String rno = createNewRno(); int rating = -1; String reviewText = ""; // Get reviewer email User user = User.getInstance(); String email = user.getEmail(); // Boolean to check if the user has entered an int for rating boole...
9
public static void main(String[]args) { int limit = 100; int sumOfSquares = 0; int squareOfSum = 0; for(int i = 1; i <= limit; i++) { sumOfSquares += i*i; squareOfSum += i; //System.out.println("Sum of Squares : " + sumOfSquares + // " | Square of Sums : " + squareOfSum); } squareOfSum =...
1
public static void main(String[] args) { Connection con = null; Statement st = null; ResultSet rs = null; String url = "jdbc:mysql://sqlserver.mhscs.org:3306"; String user = "java_client"; String password = "rRcNmJsHFfD7XEjn"; try { con = DriverMana...
6
public boolean checkPath(String path, boolean isExistingFile) { File test = new File(path); if (isExistingFile && !test.isDirectory()) { if (test.exists()) { return true; } else return false; } else { File filePath = test.getParentFile(); ...
4
@Override public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) { if(!Commands.isPlayer(sender)) return false; Player p = (Player)sender; String pName = p.getName(); if(args.length != 0) return false; if(PlayerChat.plugin.Chatspy.containsKey(pName)) { PlayerChat....
3
public ArrayList<Employee> SingleEmployeeData( int EmpID) throws UnauthorizedUserException, BadConnectionException, DoubleEntryException { /* Variable Section Start */ /* Database and Query Preperation */ PreparedStatement statment = null; ResultSet results =...
8
public static void main(String[] args) throws Exception { Class.forName("net.sourceforge.jtds.jdbc.Driver"); if (args.length == 0) { FormMain frm = new FormMain(); frm.setVisible(true); } else { Properties properties = comp.loadProps(); String so...
6
private boolean refreshPlaces(Section section) { // // First of all, check to ensure that an update is required. If so, // generate new places for underlying tiles: if (section == null) return false ; final float time = world.currentTime() ; Caching caching = allCached.get(section) ; if (...
6
private void computeLater(final ExprInfo exprInfo) { Iterator blocks = cfg.nodes().iterator(); // Initialize later to can be available... while (blocks.hasNext()) { final Block block = (Block) blocks.next(); final Phi phi = exprInfo.exprPhiAtBlock(block); if (phi == null) { continue; } phi....
8
public Body(int upgradeCount, String name) { super(upgradeCount, UpgradeType.Body, name); }
0
public void step() { if (done) { return; } yield = false; while (!(yield || done)) { if (index >= script.length) { if (stack.size() == 0) { done = true; } else { popState(); } } else { evalCommand((Object[]) script[index]); index++; } } }
5
@Override public void run() { while (this.isRunning) { try { // Tell model to update, send next key press. // or 0 if no new keypress since last update. if (updateSpeed > 0) { Thread.sleep(updateSpeed); this.gameModel.gameUpdate(nextKeyPress()); } } catch (GameOverException e) { ...
4
public void setConsumerSecret(String consumerSecret) { this.consumerSecret = consumerSecret; }
0
public byte DecodeNormal(SevenZip.Compression.RangeCoder.Decoder rangeDecoder) throws IOException { int symbol = 1; do symbol = symbol << 1 | rangeDecoder.DecodeBit(m_Decoders, symbol); while (symbol < 256); return (byte)symbol; }
1
private void send(OSCMessage oscMessage){ try { sender.send(oscMessage); System.out.println("Sent message!"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
1
@Override public int mknod(String path, int mode, int rdev) throws FuseException { try { fileSystem.createFile(path); UnixPermissions perms = new UnixPermissions(mode); if (options.isUnixOwnerImpersonateNewFiles() || options.isUnixOwnerImpersonateAllFiles()) { perms.setUid(Environment.getUserId()); ...
6
static private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpo...
9
public Boolean BuildDataSet (File dataFile) { boolean test = false; if(!checkForValidFile(dataFile)){ return false; } try { m_fileScan = new Scanner(dataFile); } catch (FileNotFoundException e) { } m_attributes = new...
8
public void close() { try { output.close(); } catch (IOException e) { e.printStackTrace(); } }
1
public List<Map.Entry<String, Double>> psuedoRelevanceCalc(QueryPhrase query, int numResults , int numTerms){ Vector<ScoredDocument> results = runQuery(query, numResults); // do the logic here Map<String, Double> frequencyMap = new HashMap<String,Double>(); for(ScoredDocument scoreddoc : results){ Docume...
7
@EventHandler(priority = EventPriority.LOW) public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); DynamicClassFunctions.addNSH(player); // Show disguises to newly joined players plugin.showWorldDisguises(player); // If he was a disguise-quitter, tell him if (plugin.disg...
9
private static void prettyPrintARound(Round r) { String[][] table = new String[r.getPairs().size() + 1][4]; table[0][0] = "PROP/AFF"; table[0][1] = "OPP/NEG"; table[0][2] = "JUDGES"; table[0][3] = "ROOM"; for (int i = 1; i < table.length; i++) { for (int j = 0; j < table[0].length; j++) { Pair p = r...
7
public TupleFour<String,String,List<Object>,List<TupleFour<String, List<Object>, String, Long>[]>> getDriveCollection() throws Exception { String cid = getDriveCollectionId(); List<Object> goal = null; List<TupleFour<String, List<Object>, String, Long>[]> priorities; if (!match(new St...
9
public static String getPinyin(String word) { String pinyin = ""; for (int i = 0; i < word.length(); i++) pinyin += getPinyin2(getCode(word.charAt(i))); return pinyin; }
1
protected void calcDIR_WrtTime() { byte[] bTemp = new byte[2]; for (int i = 22;i < 24; i++) { bTemp[i-22] = bytesOfFAT32Element[i]; } Integer temp = byteArrayToInt(bTemp); DIR_WrtTime = ((temp & 0b111110000000000) >> 10) + ":" + ((temp & 0b1111110000) >> 4) +...
1
public static void main(String[] args) { MyBorderLayout exGui1 = new MyBorderLayout(); exGui1.go(); }
0
public static List<String> keysByMeta(CSProperties csp, String mkey, String mval) { List<String> l = new ArrayList<String>(); for (String key : csp.keySet()) { if (csp.getInfo(key).keySet().contains(mkey)) { String role = csp.getInfo(key).get(mkey); if (role.e...
3
public String getParameterString(){ String retString = super.getParameterString(); try{ if(sourceText!=null) retString+="&sourceText="+sourceText; if(showSourceText!=null) retString+="&showSourceText="+(showSourceText?"1":"0"); if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8"); ...
9
public BillNumTO generateBillNum(CounterTO counterTO){ PreparedStatement pstmt = null; Connection con = null; BillNumTO billNumTO = new BillNumTO(); int docNumId = ConstantValue.INTEGER_ZERO; String billNum = ConstantValue.EMPTY_STRING; int maxNum = ConstantValue.INTEGER_ZERO; String docType = ConstantVal...
9
@Test public void testLengthLast(){ int len = 10; calc = new DataCalc(inData, numberOfPoints); calc.createDataSet(0); outData = calc.getStructureIn(); Assert.assertTrue(outData.getLength() == len); }
0
@Test public void testTargetLocationAlwaysSelected() { ComputerPlayer player = new ComputerPlayer(); player.setLastVistedRoom('L'); int enteredRoom = 0; board.calcTargets(6, 7, 4); //pick location with at least one room as a target for(int i = 0; i < 100; i++) { BoardCell selected = player.pickLocation(...
2
public boolean canPlaySoldier(int playerIndex, HexLocation hexLoc, int victimIndex) { //Checks status, players turn, has player already played dev card, if the player has a soldier card, //If the robber is not already in the designated HexLocation, and if the victim has cards to steal. if (generalDevCardPrecondit...
4
public void printPatientsBackwards() { if (nextPatient == null) { System.out.println("Patient: " + name + ", age: " + age + ", illness: " + illness); } else { nextPatient.printPatientsBackwards(); System.out.println("Patient: " + name + ", age: " + age + ", illness: "...
1
public void shoot(){ if(currentLevel==2 || currentLevel == 3){ bullet = new StarBullet(this); if(playerFacing == 1){ bullet.move(new Vec2(getPlayer().getPosition().x + -40, getPlayer().getPosition().y)); bullet.setAngularVelocity(12); bullet.set...
4
public static Matrix readFromFile(String path, DataType dataType) throws MatrixIndexOutOfBoundsException { Matrix matrix = null; int rows; int cols; try { Scanner in = new Scanner(new FileReader(path)); rows = in.nextInt(); cols = in.nextInt(); ...
3
public void draggedMouse(Point p) { int x = (int) (p.getX() / tileSize); int y = (int) (p.getY() / tileSize); int objLocX = (int) ((p.getX() - (x * tileSize)) / (tileSize / 3)); int objLocY = (int) ((p.getY() - (y * tileSize)) / (tileSize / 3)); int objLoc = (objLocY * 3) + objLocX; int fenceLocX = (i...
4
@Override public Token parse() { Token test = first.getNext(); if (test.isOperator()) { Operator testOp = test.getOperator(); if (testOp.name().startsWith("ASSIGN")) { variable = new Variable(first, scope); variable.parse(); assignmentOp = testOp; test = test.getNext(); assignmentExp = ne...
3
public static Application valueOf(short id) { for (Application application : Application.values()) { if (application.getId() == id) return application; } // same behavior as standard valueOf(string) method throw new IllegalArgumentException("No enum const for id " + id); }
2
@Override public void update() { p.update(); handleInput(); op.update(); if (op.health <= 1) { endResult = "Player1 Wins !"; freeze(); } else if (p.health <= 1) { endResult = "You Lost !"; freeze(); } else { endResult = ""; } }
2
public boolean pass(int[] bowl, int bowlId, int round, boolean canPick, boolean mustTake) { float[] currentBowl = Vectors.castToFloatArray(bowl); numFruits = Vectors.sum(currentBowl); if (!canPick){ log("CANT PICK RETURNING EARLY"); return false; } log("|||||||||||||||||||||||||||||||||...
3
protected void createSubbands() { int i; if (mode == Header.SINGLE_CHANNEL) for (i = 0; i < num_subbands; ++i) subbands[i] = new SubbandLayer2(i); else if (mode == Header.JOINT_STEREO) { for (i = 0; i < header.intensity_stereo_bound(); ++i) subbands[i] = new SubbandLayer2S...
6
public void visit_ldc(final Instruction inst) { final Object operand = inst.operand(); if ((operand instanceof Long) || (operand instanceof Double)) { height += 2; } else { height += 1; } }
2
public static void displayMenu(String input) { if(menuNumber.equals("0") && input.equals("0")) { System.out.println("Goodbye!"); System.exit(0); } switch (input) { case "0": { System.out.println("What would you like to do?"); System.out.println("0) exit program"); System.out.prin...
6
private void intalize (){ if (initCounter == 1){ //x and y values startX = 0; startY = 0; endX1 = 10; endY1 = 12; endX2 = 39; endY2 = 12; endXf = 49; endYf = 24; topSpace = 15; leftSpace = 12; //spaces from the top and left, hardcoded on e...
7
public void actionPerformed(ActionEvent e) { try { Object source = e.getSource(); if (source == menuItemFileOpen) { fileOpen(); } else if (source == menuItemHelp) { help(); } else if (source == buttonActivate) { initWorkflow(); activateWorkflow(); } else if (sour...
8
private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) { switch(hiByte) { case 0: return ((jjbitVec4[i2] & l2) != 0L); case 48: return ((jjbitVec5[i2] & l2) != 0L); case 49: return ((jjbitVec6[i2] & l2) != 0L); case 51: re...
6
@Override protected void reactPressed(MouseEvent event) { ProgramState curr = StateMachine.getState(); if (curr != ProgramState.ARR_PLAYING) { if ((Settings.debug & 0b100000) != 0) System.out.println("Move song " + moveAmt); ObservableList<String> l = theStaff...
5
public static JSONObject getJson(final Entity result, final String returnField) { JSONObject jsonObject = new JSONObject(); if (result != null) { try { if (returnField == null || "ID".equals(returnField)) { if (result.getKey().getName() != null) { jsonObject.put("ID", result.getKey().getN...
9
public void setCurrentSquare(String square){ yCoord = Integer.parseInt(square.substring(1,2)); switch(square.charAt(0)){ case 'a': xCoord=1; break; case 'b': xCoord=2; break; case 'c': xCoord=3; break; case 'd': xCoord=4; break; case 'e': xCoord=5; break; case 'f': xC...
8
public WindowCastle(core.Player p, core.Castle c, core.Hero h) { super(); //setStyleSheet("background-color: #333; color: white;"); player = p; castle = c; hero = h; Hero g = c.getGarission(); setLayout(layout); buyWidget.setLayout(buyLayout); buys[0] = new WidgetBuy(p, c, core.CastleBuil...
3
public static void main(String[] args) { int numbers[] = {1, 2, 3, 5, 8, 13}; System.out.println("First member of this array is " + numbers[0]); System.out.println("Last member of this array is " + numbers[numbers.length - 1]); }
0
@Override public Auction[] search(String criteria) { ArrayList<Auction> temp = new ArrayList<Auction>(); for(Auction auc : search){ if(auc.getName() == criteria){ temp.add(auc); } } return temp.toArray(new Auction[temp.size()]); }
2
public void enqueue (Animal a) { a.setTime( time ); if (a instanceof Dog) { dogs.addLast( a ); }else if (a instanceof Cat) { cats.addLast( a ); } }
2
private void decodeHeader(BufferedReader in, Properties pre, Properties parms, Properties header) throws InterruptedException { try { // Read the request line String inLine = in.readLine(); if (inLine == null) return; StringTokenizer st = new StringTokenizer( inLine ); if ( !st.hasMoreToken...
9
private static ImageIcon loadImage(String path) { try { InputStream stream = getResource(path); if (stream != null) { ImageIcon icon = new ImageIcon(ImageIO.read(stream)); if (icon.getImageLoadStatus() ...
3
public int compareTo(Object o) { TreeElement other = (TreeElement) o; if (leaf != other.leaf) // files come after directories return leaf ? 1 : -1; return fullName.compareTo(other.fullName); }
2
public int checkScore(int score){ if(m_scoreBoard.isEmpty()){ return 0; } else{ int index = -1; //DEscobrindo a posiçao: for(int i = 0; i < 5; i++){ if(score >= m_scoreBoard.get(i).getM_maxCoins()){ ...
8
@EventHandler public void BlazeHunger(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.getBlazeConfig().getDouble("Blaze.Hunger.Dodg...
6
private void createPswEntry() { content = new Composite(shell, SWT.NONE); content.setLayout(new FormLayout()); FormData fd_content = new FormData(); fd_content.top = new FormAttachment(0); fd_content.left = new FormAttachment(0); fd_content.right = new FormAttachment(100); fd_content.bottom = new FormAtt...
6
@Override public <T extends AggregateRoot<?>> T loadOneBy(Class<T> type, Specification<T> specification) { T satisfied = null; for (final Object aggregate : aggregates.values()) { if (aggregate.getClass().isAssignableFrom(type)) { if (specification.isSatisfie...
5
public void renderHue(int xp, int yp, Sprite sprite, int hueColor) { int w = sprite.getWidth(); int h = sprite.getHeight(); yp = this.height - yp; yp-=h; double hue = Color.getHue(hueColor); double saturation = (hueColor >> 24 & 0xff) / 255.0; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++...
2
static int Pprime(int SMax, int O, int OCounter){ int S1 = 0; int S2 = 0; int S3 = 0; int OTemp = 0; while(S1 <= SMax){ S2 = 0; while(S2 <= SMax){ S3 = 0; while(S3 <= SMax){ OTemp = S1+S2+S3; if(O == OTemp){ OCounter = OCounter + 1; return OCounter; } if(...
7
public static MouseAdapter dibujarcanvas(final Ventana d){ return new MouseAdapter(){ private Point point; public void mousePressed(MouseEvent event){ Canvas c = d.getCanvas(); int selected = d.getSeleccionado(); if(!c.isDibujandoTmp()){ c.setDibujandoTmp(true); if(Ventana.CIRCULO == s...
9
public static void drawHorizontalLine(int x, int y, int length, int color) { if (y < startY || y >= endY) return; if (x < startX) { length -= startX - x; x = startX; } if (x + length > endX) length = endX - x; int total = x + y * width; for (int index = 0; index < length; index++) { pixels[to...
5
public static void traceForwardRule(Proposition rule, Proposition trigger, Cons consequents) { if ((consequents != null) && (!(consequents == Stella.NIL))) { { int indent = 11; { System.out.println("RUNNING FORWARD RULE:"); System.out.print(" TRIGGER: "); } ; ...
9
* @param depth * depth of the node. * @return node created. */ private static TreeNode createNode(List<LAB> LABValues, int k, int depth) { // Check if the List is empty if (LABValues == null || LABValues.size() == 0) return null; int axis = depth % k; // Sort the values based on the AXIS ...
9
public JSONWriter array() throws JSONException { if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') { this.push(null); this.append("["); this.comma = false; return this; } throw new JSONException("Misplaced array."); }
3
protected void fireSupportException(final ISocketServerConnection ssc, Exception exception, Long callId) { try { if (callId == null) callId = new Long(0); // set that it is error-answer to server IRemoteCallObjectMetaData meta = new RemoteCallObjectMetaData(null, RemoteCallObjectType.Res...
2
public static boolean createFile(String directory, String name, FileType type, String moduleName, boolean isPublic, boolean withTests, boolean withHeader, boolean withSource, IOutput output) { // initial checks output.writeLine("Creating file '" + name + "'..."); if (!FileUtils.isNameOk(name...
8
public void formBond(Molecule A, Molecule B, Molecule Asub, Molecule Bsub, int bondingSite1, int bondingSite2){ A.calculateMoleculeID(0,0,new int[0]); B.calculateMoleculeID(0,0, new int[0]); ArrayList<Molecule> molsA = A.split(Asub.getMolID()); A.unFlagAll(); ArrayList<Molecule> molsB...
3
private Module gfpProductionModule() { ComponentInstantiation pspaSPromoterComp_sig = new DnaComponentInstantiation( URI.create("http://turingatemyhamter.co.uk/example#GFP_production_module/pspaS_promoter"), "pspaS_promoter", pspaSPromoterComp ); Port pspaSPromoterComp_...
5
@Override public int delete(Integer idMetier) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
0
@Override public boolean execute(CommandSender sender, String[] args) { if(sender instanceof Player == false) { sender.sendMessage("You would have to be an online player"); return true; } if(!((Player)sender).getWorld().getName().equals(p.getWorld())) retu...
8
private String getLongValue(final Field field, final Object object) { Object result = getRawValue(field, object); if (result == null) { result = ""; } return result.toString(); }
1
public void fireEvent(UIEvent e) { if(e instanceof MouseEvent) { processMouseEvent((MouseEvent) e); } else if(e instanceof TimeEvent) { processTimeEvent((TimeEvent) e); } else if(e instanceof WindowEvent) { processWindowEvent((WindowEvent) e); } }
3
private void parseTerm(Object cl_o, NVObject cl_r, String str_term) { String lstr_methodName[] = str_term.trim().split(" "); if(lstr_methodName.length == 0) { BTLog.error(this, "parseTerm", str_term + " cannot be split for spaces"); return; } BTLog.debug(this, "parseTerm", "split term for method n...
7
public static ArrayList<Player> getAllPlayers() { ArrayList<Player> players = new ArrayList<Player>(); if (blueMembers != null) { players.add(blueMembers); } if (greenMembers != null) { players.add(greenMembers); } if (orangeMembers != null) { players.add(orangeMembers); } if (redMembers != nu...
4
public void visit_dup2(final Instruction inst) { // 0 1 -> 0 1 0 1 // 0-1 -> 0-1 0-1 if (Tree.USE_STACK) { saveStack(); final Expr[] s01 = stack.pop2(); if (s01.length == 1) { // 0-1 -> 0-1 0-1 final StackExpr[] s = new StackExpr[] { (StackExpr) s01[0] }; manip(s, new int[] { 0, 0 }, Stack...
6
@Override public int compareTo(Karte k) { if (farbe > k.gibFarbe()) { return -1; } else if (farbe < k.gibFarbe()) { return 1; } else if (farbe == k.gibFarbe() && nummer > k.gibNummer()) { return -1; } else if (farbe == k.gibFarbe() && nummer < ...
8
private void handleClient(String command) throws Exception { command = command.toLowerCase(); System.out.println(command); if (command.equals("get information")) { getCardsInformation(); } else if (command.equals("get statistics")) { getStatsFile(); } else if (command.equals("post configuration")) { ...
7
public void monitorFileDelete(Path file) { try { if(file.startsWith(sourceDir)){ Path subPath = sourceDir.relativize(file); for(Path targetDir : targetDirs){ Path newPath = targetDir.resolve(subPath); logger.info("rm "+newPath.toString()); Files.delete(newPath); } } } catch ...
3
public void updateAllContents() throws SQLException, IOException { Connection conn = (Connection) dbHandler.initiateSystemDBConn()[0]; ArrayList<Task> tasklisttemp = dbHandler.initiateTaskList(conn); ArrayList<TimeSpentOnTask> tsotListtemp = dbHandler.initiateTimeSpentOnTaskList(conn); ...
5
private static String packGamesListPacket(Packet packet) { StringBuilder res = new StringBuilder(); @SuppressWarnings("unchecked") ArrayList<GameLobby> data = (ArrayList<GameLobby>) packet.getData(); res.append("\n"); for(int i = 0; i < data.siz...
5
public static boolean areUserEqual(final User usr1, final User usr2) throws TestException { if (!usr1.getLogin().equals(usr2.getLogin())) { throw new TestException("Logins not equals"); } if (!usr1.getFirstName().equals(usr2.getFirstName())) { throw new TestException("Fi...
5
private List<Raum> setRaumKoordinaten(List<XmlRaum> xmlRaumListe, List<Raum> raumListe) { for(XmlRaum xmlRaum : xmlRaumListe) { for(Raum raum : raumListe) { if(raum.getId() == xmlRaum.getID()) { raum.setKoordinaten(xmlRaum.getX(), xmlRaum.getY()); raum.setItems(xmlRaum.getItems()); ...
3
@Override public List<Homonym> getAllPTWords() { List<Homonym> result = null; String sql = "SELECT portugal, popis, popis2, slovak1, skratka1, skratka1b, slovak2, skratka2, skratka2b, " + "slovak3, skratka3, skratka3b, slovak4, skratka4, skratka4b, slovak5, skratka5, skratka5b, " + ...
7
public ArrayList<EmpresaBean> getPage(int intRegsPerPag, int intPage, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception { ArrayList<Integer> arrId; ArrayList<EmpresaBean> arrEmpresa = new ArrayList<>(); try { oMysql.conexion(enumTipoConexion); ...
2
public void nextState(String airplaneId) { Query qCurrentState = em.createQuery("select e from airplane e where e.id = '" + airplaneId + "'"); if( qCurrentState.getResultList().size() > 0) { Airplane airplane = (Airplane) qCurrentState.getResultList().get(0); Airplane.State newState = State.IN_APPRO...
7
public OrderLine() { }
0
public void set_mode(short new_mode) throws IOException { byte[] data=new byte[2]; data[0]=(byte)SET_MODE; data[1]=(byte)new_mode; byte[] result = this.sendAndReceive(data, COM_TIMEOUT, 1); if (result.length==0) throw new IOException("no answer from device"); if (result[0]!=0) throw ...
2
* @param extensions * @return String */ public static String findFileInLoadPath(String file, Cons extensions) { { String expandedfile = file; if (extensions == null) { extensions = Stella.$STELLA_FILE_EXTENSIONS$; } { Stella_Object dir = null; Cons iter000 = Cons.cons(Stri...
6
public static void main(String[] args) { MyClass myClass = new MyClass(); }
0
@Override @SuppressWarnings("static-access") public double kinship(Individual indi) { if(this==indi) return 1; if(fitness!=indi.fitness)return 0; int hit = 0; int miss = 0; int n; Sudoku oth = (Sudoku) indi; for (int r=0; r<9; r++) for(int c=0; c<9; c++) if((n=rows[r][c])>0) if(n==oth.rows[...
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Physical target=mob.location(); if(target==null) return false; if(target.fetchEffect(ID())!=null) { mob.tell(L("This place is already consecrated.")); return false; } if(!supe...
8
public static UUID fromString(String name) { String[] components = name.split("-"); if (components.length != 5) throw new IllegalArgumentException("Invalid UUID string: "+name); for (int i=0; i<5; i++) components[i] = "0x"+components[i]; long mostSigBits = Long.decode(components[0]).lon...
2
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
7
public boolean canUpdateUnit(int id) { if (((id >= 21 && id <= 26) || id == 31) && candy >= candyTable.get(id)) return true; else return false; }
4
private JPopupMenu createToolMenu() { final JPopupMenu ret = new JPopupMenu(); ImageIcon publicImg = null, protectImg = null, privateImg = null, packageImg = null, upImg = null, downImg = null; ImageIcon addItemImg = null, delItemImg = null; try { addItemImg = new ImageIcon(ImageIO.read(this.getClass() ...
9