text
stringlengths
14
410k
label
int32
0
9
public Piece(Position position, String couleur) { this.position = position; this.Couleur = couleur; this.Image = ""; this.positionDuMechant = null; this.DejaDeplace = false; this.NombreDeDeplacement = 0; for (int i = 0 ; i < 8 ; i++) for(int j = 0 ; j < 8 ; j++) this.PositionPossible[i][j] =...
2
private void renderWall(double x0, double y0, double x1, double y1) { double xo0 = ((x0 - 0.5) - xCam) * 2; double yo0 = ((y0 - 0.5) - yCam) * 2; double xx0 = xo0 * rCos - yo0 * rSin; double u0 = ((-0.5) - zCam) * 2; double l0 = ((+0.5) - zCam) * 2; double zz0 = yo0 * rC...
8
public static Iterator toIterator(Object value, char delimiter) { if (value == null) { return IteratorUtils.emptyIterator(); } if (value instanceof String) { String s = (String)value; if (s.indexOf(delimiter) > 0) { return split((String)value, ...
5
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 boolean Chk_Pkmn(String str){ boolean bl = false; Reader reader = new Reader(); try{ // pokomon_name.txtからポケモン名を取得. String txt_pkmn[] = reader.txtReader(Const.POKEMONNAME_NORMAL); // 範囲チェック. if (!(util.isRange(str.length(), 0, 10))){ return bl; } // 対象ポケモン名がpokemon_name...
4
public DNode getPrev(DNode v) throws IllegalStateException{ if(isEmpty()) throw new IllegalStateException("List is empty"); return v.getPrev(); }
1
public FullGridFactory getGridFactory() { if (inputStream != null) if (gameTypeSelect.getSelectedItem().equals(GameType.RACE_MODE)) return new FileGridFactory(inputStream); else return new FileGridFactoryCTF(inputStream); else if (gameTypeSelect.getSelectedItem().equals(GameType.RACE_MODE)) ret...
3
void paintFlow(CPRect srcRect, CPRect dstRect, byte[] brush, int w, int alpha) { int[] opacityData = opacityBuffer.data; int by = srcRect.top; for (int j = dstRect.top; j < dstRect.bottom; j++, by++) { int srcOffset = srcRect.left + by * w; int dstOffset = dstRect.left + j * width; for (int i = ds...
3
public DataSource assemble(ServletConfig config) throws ServletException { DataSource _ds = null; String dataSourceName = config.getInitParameter("data-source"); System.out.println("Data Source Parameter" + dataSourceName); if (dataSourceName == null) throw new ServletException("data-source must be specified...
4
@Override public String toString() { return "{id=" + id + ",intencity=" + intencity + ",fw1=" + firewallId1 +",fw2=" + firewallId2 + ",managerFw=" + managerFirewallId + "}"; }
0
private boolean evaluateProposition(Proposition prop){ switch(prop){ case IS_FRONT_CLEAR: return karel.isFrontClear(); case IS_LEFT_CLEAR: return karel.isLeftClear(); case IS_RIGHT_CLEAR: return karel.isRightClear(); case IS_FACING_NORTH: case IS_FACING_SOUTH: case IS_FACING_EAST: case IS...
8
public int lengthOfLongestSubstring(String s) { // Start typing your Java solution below // DO NOT write main() function if (s == null) return 0; int length = s.length(); if (length <= 1) { return length; } int[] f = new int[length]; f[0] = 1; int max = 1; Map<Character, Integer> charMap = new...
6
public static void main(String[] args) { System.out.println("Simple client for financial modeling server"); System.out.println("Trying to connect"); System.out.println(HOSTNAME + ": " + PORT); System.out.println("Run client with params: <HOST> <PORT> <TIME_OUT> for changing default sett...
2
public String getRepeatedChars(String one, String two) { Map<Character, Integer> charFrequency; StringBuilder builder = new StringBuilder(); String longer; if (one.length() > two.length()) { charFrequency = makeCharFrequencyMap(two); longer = one; } else {...
9
public static List<MorrisBoard> generateMove(MorrisBoard crtBoard) { List<MorrisBoard> possibleBoard = new ArrayList<MorrisBoard> (); for (int indexMoveFrom = 0; indexMoveFrom < MorrisBoard.TOTALPOS; indexMoveFrom++) { MorrisIntersection intersection = crtBoard.getIntersection(indexMoveFrom); if (intersect...
5
public void visit_fneg(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
1
public static void createUI(String type, String userName) { if (type.equals("Login")) { new LoginUI(); } else { switch (type) { case "Admin": new AdminUI(userName); break; case "SchoolDean": new SchoolDeanUI(userName); break; case "DeptAD": new DeptADUI(userName); break; ca...
6
public void testToStandardHours_overflow() { Duration test = new Duration(((long) Integer.MAX_VALUE) * 3600000L + 3600000L); try { test.toStandardHours(); fail(); } catch (ArithmeticException ex) { // expected } }
1
@Override public void actionPerformed(ActionEvent event) { if (event.getSource() == addItem) { String name = itemName.getText(); String key = itemKey.getText(); String type = types[itemType.getSelectedIndex()]; Item item; try { item = new Item(name, key, type); } catch (GameReaderException e) {...
9
public void expression3() { if(have(Token.Kind.NOT)){ expectRetrieve(Token.Kind.NOT); have(NonTerminal.EXPRESSION3); expression3(); } else if(have(Token.Kind.OPEN_PAREN)){ expectRetrieve(Token.Kind.OPEN_PAREN); have(NonTerminal.EXPRESSION0); expression0(); expectRetrieve(Token.Kind.CLOSE_...
5
private boolean inBoundingBox(int mouseX, int mouseY) { int x = this.x + (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0); int y = this.y + (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0); int width = this.width - (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0) + (depth > ...
9
private synchronized int waitSum() { int waitSum = 0; for (int count : waitEntry) waitSum += count; return waitSum; }
1
public static boolean searchMatrix(int[][] matrix, int target) { int m = matrix.length; int n = matrix[0].length; if (target < matrix[0][0] || target > matrix[m - 1][n - 1]) return false; int low = 0; int high = m * n; int mid = 0; while (low <= high) { m...
5
@Override public void init() { /* 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://download.o...
9
private List<Opdracht> toonOpdrachtenVanCategorie() { List<Opdracht> tempList = new ArrayList<Opdracht>(); for (Opdracht opdr : opdrachtCatalogusModel.getOpdrachten()) { if (quizCreatieView.getCategorie().getSelectedItem() .equals(OpdrachtCategorie.Aardrijkskunde) && opdr.getOpdrachtCategorie().equals(...
9
@Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String lines[] = value.toString().split(inputDelimiter); String outputLine = ""; boolean checked = false; for (String line : lines) { if (line.equals(target)) checked = true; } if ...
4
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
9
public void run() { playing = true; while (true) { gun.init(); playGame(); if (!playing) break; System.out.print("Would you like to play again [y/n]? (n): "); try { ...
5
public int solution( String input ) { final Deque<Character> stack = new ArrayDeque<Character>(); boolean isProperlyFormed = true; for ( int i = 0; i < input.length(); i++ ) { char character = input.charAt( i ); if ( isOpenBracket( character ) ) { stack.push( character ); ...
7
public void follow() { if(centerX < -95 || centerX > 810){ movementSpeed = 0; } else if (Math.abs(robot.getCenterX()-centerX) < 5){ movementSpeed = 0; } else { if (robot.getCenterX() >= centerX) { movementSpeed = 1; } else { movementSpeed = -1; } } }
4
private final void step6() { j = k; if (b[k] == 'e') { int a = m(); if (a > 1 || a == 1 && !cvc(k-1)) k--; } if (b[k] == 'l' && doublec(k) && m() > 1) k--; }
7
public static void recursive(String strPath) { File file = new File(strPath); if(file.isDirectory() && !file.getName().equals(".svn")) { File[] listfiles = file.listFiles(); for(File f : listfiles) { recursive(f.getAbsolutePath()); } } else if (file.isFile() && (file.getName().contains("Jedis") ...
9
public void readFrom(InputStream in) throws IOException { byte[] arr = new byte[32]; int[] off = { arr.length, arr.length }; ArrayList<Byte> bytes = new ArrayList<>(); try { if (readInt(in, arr, off) < version) return; int i; while ((i = readInt(in, arr, off)) != -1) { objectIds.add(i); } ...
9
@Override public Connection crearConexion() { try { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/ausiasyield", "root", "bitnami"); return connection; } catch (ClassNotFoundException ex) { ...
2
public void updateGrbit() { grbit = 0; grbit |= valType; grbit |= (errStyle << 4); grbit |= (IMEMode << 10); if( fStrLookup ) { grbit = (grbit | BITMASK_FSTRLOOKUP); } if( fAllowBlank ) { grbit = (grbit | BITMASK_FALLOWBLANK); } if( fSuppressCombo ) { grbit = (grbit | BITMASK_FSUPRES...
5
public String getRatioOfTwoArray(List<String> list1, List<String> list2) { int common = 0; int total = 0; if (list1.size() > list2.size()) { total = list1.size(); for (String obj : list2) { if (list1.contains(obj)) { common++; } else { total++; } } } else { total = list2.size()...
6
public static double compositeSimpsonsRule(SingleVarEq f, double a, double b, int steps){ // N must be positive and even if(steps < 0 || steps % 2 != 0){ throw new IllegalArgumentException("Steps must be positive and even"); } double h = (b - a) / steps; double endSum = f.at(a) + f.at(b); // sum the end p...
4
public UWECImage createMosaic(UWECImage image) { // scales our mosaic image image.scaleImage(horzMosaicSize, vertMosaicSize); // create a new blank uwecimage UWECImage blankMosaic = new UWECImage(horzMosaicSize, vertMosaicSize); // create threads and total number of tiles to be used int numOfThreads = (ho...
3
public void init() { matches = Competition.getInstance().getCodeRedSchedule(); batteryList = new ArrayList<>(); for (Match match : matches) { batteryList.add(match.getBattery()); } if (matches == null) { matches = new ArrayList<>(); } }
2
protected static Instances getMiningSchemaAsInstances(Element model, Instances dataDictionary) throws Exception { ArrayList<Attribute> attInfo = new ArrayList<Attribute>(); NodeList fieldList = model.getElementsByTagName("MiningField"); int classI...
8
public Set getDeclarables() { Set used = new SimpleSet(); if (type == FOR) { incrInstr.fillDeclarables(used); if (initInstr != null) initInstr.fillDeclarables(used); } cond.fillDeclarables(used); return used; }
2
public InfoRequest(final String id, String... emails) { this.id = id; for (String email : emails) { addEmail(email); } }
1
public Game() { //create the JFrame and add the display to it frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1024, 600); frame.setVisible(true); frame.add(display); //initialize room Environment room = new YourRoom(); //initialize lab Environment ...
7
public ArrayList<ArrayList<Integer>> combinationSum(int[] candidates, int target) { ArrayList<ArrayList<Integer>> rst = new ArrayList<ArrayList<Integer>>(); Arrays.sort(candidates); if (target == 0) { rst.add(new ArrayList<Integer>()); return rst; } for (int i= 0 ; i < candida...
5
private static void heapsort(int a[]) { int n = a.length; int parent, left, right, max; makeHeap(a); System.out.println("array after converting into heap...\n"); for (int k : a) System.out.print(k + " "); for (int i = n - 1; i > 0; i--) { swap(a, 0, i); parent = 0; while (true) { left = (2 *...
9
public void update(Observable o, Object arg) { // TODO Auto-generated method stub }
0
protected void createRandomChromosomes() { int[] newChromosomes = new int[numberOfChromosomes]; int crossSum = 0; boolean startFromEnd = false; if (getRandom() < 0.5) { startFromEnd = true; } for (int i = 0; i < newChromosomes.length; i++) { if (getRandom() < 0.25) { conti...
5
private void saveResource(String username) { if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.USER_MNG)) { return; } User user = MyFactory.getUserService().queryUserByName(username); List<String> displayNames = new ArrayList<String>(); ...
6
@Override protected void loadPlays(Position position, Player cpu, int largestCapture){ FactoryOfPlays factory = new FactoryOfCapturingsForPiece(position,cpu.getBoard()); int bestEvaluation=-100; for(AbstractPlay play:factory){ int evaluation = evaluate(play,cpu,largestCapture); if(evaluation>=bestEvaluatio...
3
public void answerCase(int id, String user) { switch(id){ case 1: //connected to server, got welcome message send(id, userName, null, Main.mainData.userName); break; case 2: //username accepted userName = message; Main.gui.serverMessage("Username: " + message + " accepted!"); send(id, userName...
8
public Contact[] sortContacts() { //Stored the stored Contact[] Contact[] sortedContactArray = new Contact[addedContactCount]; //Create a copy of the original Contact[] so the original Contact[] won't be contaminated after sorted. System.arraycopy(contacts, 0, sortedContactArray, 0, addedContactCount)...
9
static public String composeMultipleApiCommands(String... commands) { StringBuilder apiCmd = new StringBuilder(256); apiCmd.append("(LIST "); for (Object command : commands) { apiCmd.append(command); } apiCmd.append(')'); return apiCmd.toString(); }
1
@Override public Pixel[][] getDisplay() { Pixel[][] display = new Pixel[thisTick.length][thisTick[0].length]; for (int row = 0; row < thisTick.length; row++) { for (int col = 0; col < thisTick[row].length; col++) { display[row][col] = new Pixel(row...
3
public ChocolateChip() { print("ChocolateChip()"); }
0
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 static void processT(String tempDir) throws FileNotFoundException, NoSuchElementException, IOException, ProcessException { File trigramSortedInterDataFile = FileUtil.getFileInDirectoryWithSuffix(tempDir, TrigramExternalSort.DATA_SUFFIX); File unigramDataFile = FileUtil.getFil...
8
private void addState(Element element, StateMachineBuilder builder) throws BadStateMachineSpecification{ // this will be refactored when something other than basic state is instroduced if (element.hasAttribute(ENABLE_ASPECT_TAG)) { int properties = StateMachineBuilder.STATE_PROPE...
7
public String getClientId() { return clientId; }
0
protected boolean isCollision(Vector3d v3d) { Transform3D t3d = new Transform3D(); tg.getTransform(t3d); Matrix4d m4d = new Matrix4d(); t3d.get(m4d); GMatrix gm1 = new GMatrix( 4, 1, new double[] { v3d.x, v3d.y, v3d.z, 0.0 } ); GMatrix gm2 = new GMatrix( 4, 4, new doub...
7
public static void toggleToPlayersTownyChannel( String sender, String channel, boolean hasTown, Boolean hasNation ) throws SQLException { BSPlayer p = PlayerManager.getPlayer( sender ); if ( !hasTown ) { p.sendMessage( Messages.TOWNY_NONE ); return; } if ( p.getCh...
5
public void loadConfigFiles(){ try { loadPlayerConfigFile(playerFile); loadCardConfigFile(cardFile); } catch (FileNotFoundException e) { System.out.println(e); } catch (BadConfigFormatException e) { System.out.println(e); } }
2
public int count() { return count; }
0
public static void dropLocalDatabaseAndUser(MySQLIdentity root, MySQLIdentity newIdentity) throws SQLException, MySQLException { if((root.host == null) || (newIdentity.host == null)) { throw new MySQLException("Host not specified");} if(root.host.equals(newIdentity.host) == false) { throw new MySQLException("Hosts...
3
public Browser getGroup() { if (this.parent != null) { return parent.getGroup(); } return this; }
1
public boolean pass(int[] bowl, int bowlId, int round, boolean canPick, boolean musTake) { counter++; if(counter==1){ for(int i=0;i<12;i++){ bowSize+=bowl[i]; } //update(bowSize*6); } update(bowl,bowlId,round); ...
8
private void buildProfitsArray(int[] prices, int[] leftProfits, int[] rightProfits) { int min = Integer.MAX_VALUE; for (int i = 0; i < leftProfits.length; i++) { if (prices[i] < min) { min = prices[i]; } //leftProfits[i] = i == 0 ? 0 : Math.max(left...
6
private int hasPresencePort() { return (port == null || port > NO_PORT) ? hasPresence(host) : 0; }
2
public static void main(String[] args) { boolean error = false; String path = "BIGxml.xml"; try { if (args.length > 0) { if (isValidXML(args[0])) { path = args[0]; } else { System.out ...
5
private void buildLists() { Iterator iter = roots().iterator(); preOrder = new NodeList(); postOrder = new NodeList(); final Set visited = new HashSet(); // Calculate the indices of the nodes. while (iter.hasNext()) { final GraphNode root = (GraphNode) iter.next(); Assert.isTrue(nodes.containsValu...
3
public static String getAlias(Class<? extends ConfigurationSerializable> clazz) { DelegateDeserialization delegate = clazz.getAnnotation(DelegateDeserialization.class); if (delegate != null) { if ((delegate.value() == null) || (delegate.value() == clazz)) { delegate = null; ...
7
public void run(){ if(true) return; Socket c; try { while((c = socket.accept()) != null){ c.close(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
3
public static char getCharFromPiece(Piece in) throws IllegalArgumentException{ char out; switch(in){ case KING:{ out = ChessConstants.KING_PIECE_CHAR; break; } case QUEEN:{ out = ChessConstants.QUEEN_PI...
5
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
@Override public int getNeighborCountOf(int x, int y) { int count = 0; if (cellLivesAt(x, y + 1)) { count++; } if (cellLivesAt(x, y - 1)) { count++; } if (cellLivesAt(x - 1, y)) { count++; } if (cellLivesAt(x - 1, y ...
8
public void execute(int ticksLeft) { boolean runMain = !playerQueue.isEmpty(); if (runMain) { // Set ticks left this.ticksLeft = ticksLeft; // Fetch the max number of threads currentThreads = cfg.spawnFinderThreads; // Find a reasonable number of threads to run the main task in for (...
5
public int indexOf(int gridletId, int userId) { ResGridlet gl = null; int i = 0; Iterator<ResGridlet> iter = super.iterator(); while (iter.hasNext()){ gl = iter.next(); if (gl.getGridletID()==gridletId && gl.getUserID()==userId) { return i; ...
3
public void addAccount(BankAccount account) throws IllegalArgumentException { if (! canHaveAsAccount(account)) throw new IllegalArgumentException(); accounts.add(account); }
1
private boolean canEventResponse() { // 豁サ菴薙�辟。逅� if(dead) return false; if(getCriticalDamege() == CriticalDamegeType.CUT) return false; // 縺�s縺�s逶エ蜑阪�蜍輔¢縺ェ縺�憾諷九�辟。逅� if(shitting) return false; // 蜃コ逕」逶エ蜑阪�蜍輔¢縺ェ縺�憾諷九�辟。逅� if(birth) return false; // 縺吶▲縺阪j繧「繝九Γ繝シ繧キ繝ァ繝ウ荳ュ縺ッ辟。逅� if(sukkiri) return false;...
7
public void setQuantity(String quant) { String[] strings = quant.split("-|\\s"); for (String string : strings) { System.out.println(string); } if (strings.length>=2) { System.out.println(""+strings.length); for (String string : strings) { i...
4
private void setCorrectLocationDefault(Attributes attrs) { // find the value to be set, then set it if (attrs.getValue(0).equals("fontname")) { quizSlideDef.setCorrectFont(attrs.getValue(1)); } else if (attrs.getValue(0).equals("fontsize")) { quizSlideDef.setCorrectSize(Float.valueOf(attrs.getValue(1))); ...
6
public int size() { return count; }
0
public Location getAdjacentLocation(int direction) { // reduce mod 360 and round to closest multiple of 45 int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE; if (adjustedDirection < 0) adjustedDirection += FULL_CIRCLE; adjustedDirection = (adjustedDirect...
9
public void tick() { /** Ticking the buttons */ for (int i = 0; i < buttons.size(); i++) { buttons.get(i).tick(); if (buttons.get(i).getTitle().equalsIgnoreCase("online") && buttons.get(i).getClicked()) { main.menus.get(3).init(); } } }
3
public void createRoleOnIncident(ArrayList<BERoleTime> roleTime, int roleNumber) { if (roleTime == null) { BLLError.getInstance().functionError(); return; } if (roleNumber > 4 || roleNumber < 1) { BLLError.getInstance().functionError(); return; ...
9
@Override public Object process(Object value, ValueProcessInvocation invocation) throws BeanMappingException { // 处理下自己的业务 BeanMappingField currentField = invocation.getContext().getCurrentField(); if (value == null && StringUtils.isNotEmpty(currentField.getDefaultValue()) && cur...
6
public static void OBRADI_init_deklarator(){ String linija = mParser.ParsirajNovuLiniju(); // ucitaj <izravni_deklarator> int trenLabela = Izrazi.mBrojacLabela++; int stogPrijeIzravnogDek_Lok = (NaredbenaStrukturaPrograma.mStog == null) ? 0 : NaredbenaStrukturaPrograma.mStog.size(); int stogPrijeIzravnogDek_Glo...
8
public int getAVO() { return avoid; }
0
public void connect(TreeLinkNode root) { if (root ==null) return; if (root.next !=null&&root.right !=null&&root.next.left!=null){ root.right.next = root.next.left; } if (root.left!=null&&root.right!=null){ root.left.next = root.right; } ...
6
public IntelligentLine(Connector from, Connector to) { super(from, to); cpFrom = from.getParent(); cpTo = to.getParent(); panel = cpFrom.getPanel(); for (Component c : cpFrom.getPanel().getElements()) add(c); // add(cpFrom); // add(cpTo); Point mp = Component.getMidPoint(cpFrom, cpTo); add(mp); ...
3
public long read5bytes() throws IOException { long b0 = read(); long b1 = read(); long b2 = read(); long b3 = read(); long b4 = read(); if (le) return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24) | (b4 << 32); else return b4 | (b3 << 8) | (b2 << 16) | (b1 << 24) | (b0 << 32); }
1
public static Connection getCon() { if (con == null) con = initConnection(); return con; }
1
protected void fillOutCopyStats(final Modifiable E, final Modifiable E2) { if((E2 instanceof MOB)&&(!((MOB)E2).isGeneric())) { for(final GenericBuilder.GenMOBCode stat : GenericBuilder.GenMOBCode.values()) { if(stat != GenericBuilder.GenMOBCode.ABILITY) // because this screws up gen hit points { ...
8
public static QuestPoint createQuest(QuestType type){ QuestPoint quest = null; switch(type){ case TEXTQUEST: quest = new TextQuest(); break; case CHOICEQUEST: quest = new ChoiceQuest(); break; case FIELDQUEST: quest = new FieldQuest(); break; case ORDERQUEST: quest = new O...
5
@Override public void run() { while (!Thread.currentThread().isInterrupted()) { try { generateQuotes(); Thread.sleep(10); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
2
@Override public List list(Integer firstResult, Integer maxResults) throws Exception { try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); //Query q = session.getNamedQuery("find.all"); Query q = session.getNamedQuery(g...
1
public void testAdd_DurationFieldType_int3() { MutableDateTime test = new MutableDateTime(TEST_TIME1); try { test.add((DurationFieldType) null, 6); fail(); } catch (IllegalArgumentException ex) {} assertEquals(TEST_TIME1, test.getMillis()); }
1
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Endereco other = (Endereco) obj; if (this.idEndereco != other.idEndereco && (this.idEndereco == null || !...
5
public static VertexIdTranslate fromString(String s) { if ("none".equals(s)) { return identity(); } String[] lines = s.split("\n"); int vertexIntervalLength = -1; int numShards = -1; for(String ln : lines) { if (ln.startsWith("vertex_interval_length=")) {...
6
@RequestMapping(value = "/hall-event-speaker-list/{hallEventId}", method = RequestMethod.GET) @ResponseBody public SpeakerListResponse eventSpeakerList( @PathVariable(value = "hallEventId") final String hallEventIdStr ) { Boolean success = true; String errorMessage = null; ...
1
public void perform(Request r) throws Exception { PaxosMessage commit = new PaxosMessage(); commit.setRequest(r); commit.setMessageType(PaxosMessageEnum.REPLICA_COMMIT); commit.setSrcId(this.processId); commit.setSlot_number(slotNumber); //check if already performed. for(Entry<Integer,Request> ...
9