method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d9d2500c-eba3-47ae-9259-3ca6d69a7ef6 | 4 | private static void decodeInput(char keyChar) {
Movement.checkAllFalse();
switch (keyChar) {
case 'a':
Movement.MOVEMENT[Movement.LEFT] = true;
Miscellaneous.log("LEFT");
break;
case 'w':
... |
1aad41b5-eb04-45a2-9931-582a2f591317 | 5 | public static void load(ImageSet imageSet){
DataBaseHandler db = new DataBaseHandler();
ResultSet resultado = null;
String sql = "select code, name, link from images";
try {
resultado = db.consultar(sql);
if(resultado != null){
... |
f6aa92db-41e4-4d1b-ad2e-3caece7cb300 | 1 | private void addPlayersOnGrid() {
for (Player p : players) {
grid.addElement(p);
grid.addElement(p.getLightTrail());
factory.addObservable(p);
factory.addObserver(p);
factory.addObservable(p.getLightTrail());
}
} |
f84efb5a-e6a1-4b3c-92d2-e93605f35d4d | 5 | public static String getSql(String path) {
String content = "";
StringBuffer strbuf = new StringBuffer();
File f = new File(path);
if (f.exists() && f.canRead()) {
System.out.println("Filehandle auf " + path);
BufferedReader read;
try {
read = new BufferedReader(new FileReader(f));
w... |
48716935-4602-4a3e-bc92-b4bc37763519 | 9 | @Override
public CodeLineList generateCode(Code relatedClass, Method relatedMethod,
boolean forCodeGeneration) {
CodeLineList typeCodeList = this.getChild(0).generateCode(relatedClass,
relatedMethod, true);
CodeLine typeLine = typeCodeList.getCodeLine(0);
String type = typeLine.getCode();
if (type.conta... |
08b0a3fb-7b1f-47d2-85c9-18fc9be7a9d2 | 8 | public int hashCode()
{
int _hashCode = 0;
_hashCode = 29 * _hashCode + id;
_hashCode = 29 * _hashCode + (idModified ? 1 : 0);
if (email != null) {
_hashCode = 29 * _hashCode + email.hashCode();
}
_hashCode = 29 * _hashCode + (emailModified ? 1 : 0);
if (salt != null) {
_hashCode = 29 * _hashCod... |
c85b0750-935a-4ed6-980f-d57c4a0184eb | 3 | public boolean intersects(int x0, int y0, int x1, int y1) {
return !(x + xr < x0 || y + yr < y0 || x - xr > x1 || y - yr > y1);
} |
b10ca22e-9d79-4e4e-b899-0fdf1eeee580 | 6 | @Override
protected String buildSearchQuery() {
Category cat = (Category) e;
String query = ""
+ "SELECT * "
+ "FROM category "
+ "WHERE 1=1 ";
if (cat.getName() != null && !cat.getName().equals("")) {
query += " AND Name LIKE '%"... |
186c4a37-df7e-4002-868c-f96a39d9902f | 7 | public void action() throws Exception {
if (isEnd) {
return;
}
if (needStart) {
updatePosition();
if (FieldGame.isFreeFromBricks(id, pos_x, pos_y)) {
writeMailbox(BrickGame.bluetooth_mailboxSystem, direction,
BrickGame.bluetooth_mailboxGotIt);
writeMailbox(BrickGame.bluetooth_mailboxSystem... |
c713e413-f462-4de2-bd26-cdb1e9b64ff2 | 1 | public boolean getNappaimenTila(int nappain){
if (nappainTilat.containsKey(nappain)){
return nappainTilat.get(nappain);
} else {
return false;
}
} |
df27b71e-375f-4a40-93c1-0786e6c9ea95 | 5 | @Override
public void play()
{
switch( channelType )
{
case SoundSystemConfig.TYPE_NORMAL:
if( clip != null )
{
if( toLoop )
{
clip.stop();
clip.loop( Clip.LOOP_CON... |
e27a3164-067d-47c7-a6a0-811eb40ca0c0 | 1 | public void testIsEqual_LocalDate() {
LocalDate test1 = new LocalDate(2005, 6, 2);
LocalDate test1a = new LocalDate(2005, 6, 2);
assertEquals(true, test1.isEqual(test1a));
assertEquals(true, test1a.isEqual(test1));
assertEquals(true, test1.isEqual(test1));
assertEquals(tr... |
c0153de6-f3a4-45a2-b9f6-372dafe3872b | 7 | private static boolean doesDetectedPolygonMatchesWithRoads(ArrayList<Position> detectedPolygon, ArrayList<Road> roads)
{
ArrayList<Road>[] roadListByNode = new ArrayList[detectedPolygon.size()];
for (int i = 0; i < detectedPolygon.size(); i++)
roadListByNode[i] = new ArrayList<Road>();
for (int i = 0; i < de... |
84c6dc65-331a-4cf1-8194-e2243ae06cde | 5 | @Override public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
if(str == null) {
return;
} else if(str.length() + offs > maxLength) {
return;
}
char[] letters = str.toCharArray();
boolean numbers = true;
for(char c : letters) {
if(!Character.isDigit(c)) {
... |
a7635822-cd4e-43f8-aa71-721d349ae631 | 3 | @Override
public Connection getConnection() {
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("No esta instalado el Driver JDBC");
e.printStackTrace();
... |
04284480-7d18-4c9a-b424-df168ee44131 | 5 | public void run(){
setSizeField();
field.initField();
showField();
while (!check.win(player) && var.counter < field.sizeField * field.sizeField) {
player = Value.changePlayer(player);
playersMove(player);
showField();
if (check.win(player))... |
10e492e7-a7cf-44cd-b4aa-5cffa891fff8 | 1 | public void addPawn(final Pawn pawn) {
if (getSquareContent(pawn.getX(),
pawn.getY()) == null)
this.pawns.add(pawn);
} |
217c8b28-6384-4e38-a3cd-187cf365f910 | 2 | public static boolean percentChance(double percent){
if(percent > 100 || percent < 0){
throw new IllegalArgumentException("Percentage cannot be greater than 100 or less than 0!");
}
double result = new Random().nextDouble() * 100;
return result <= percent;
} |
e5568d1d-6cf2-4d64-857d-0cb9d326d20e | 4 | public static void saveReservation(Reservation reservation){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
conn.setAutoCommit(false... |
457600d8-48fe-43cf-80e9-690a4808f5f0 | 5 | public int search(int[] A, int target) {
if(target >=A[0]){
for(int i=0 ; i< A.length;i++){
if(A[i] == target)
return i;
}
}else
{
for(int i= A.length -1 ; i>=0;i--){
if(A[i] == target)
r... |
4921024c-a8b5-4d40-ab5a-4c7d11357fbc | 2 | public static String[] getParameterTypes(String methodTypeSig) {
int pos = 1;
int count = 0;
while (methodTypeSig.charAt(pos) != ')') {
pos = skipType(methodTypeSig, pos);
count++;
}
String[] params = new String[count];
pos = 1;
for (int i = 0; i < count; i++) {
int start = pos;
pos = skipType... |
5cd0c58e-614a-43b5-9c8c-5213c4e5ddde | 2 | private void closeResultSet(ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
} |
11014a2f-362a-4623-b8d7-6444bf941b5b | 5 | ClientThread(Socket socket) {
uid = uniqueID++;
this.socket = socket;
try {
//Creating I/O streams for a Client
output = new ObjectOutputStream(socket.getOutputStream());
input = new ObjectInputStream(socket.getInputStream());
//Read username that Client broadcasts to us
username = (Stri... |
ff74ac83-ea02-4c29-93a9-fe9dd9e024e4 | 0 | public void setDescription(String description) {
this.description = description;
} |
e9bbd9ac-8889-48e8-b8f6-b39d50d3ae47 | 3 | public final JSONWriter object() throws JSONException {
if (this.mode == 'i') {
this.mode = 'o';
}
if (this.mode == 'o' || this.mode == 'a') {
this.append("{");
this.push(new JSONObject());
this.comma = false;
return this;
}
... |
01f3e200-f180-4991-b4b9-ab559954f213 | 1 | @Override
public void commit() throws DaoException {
try {
mysqlConn.commit();
} catch (SQLException ex) {
throw new DaoConnectException("Error in commit connection in pool.");
}
} |
0ca18cfb-1593-48ee-85ad-9e17da40b7e5 | 9 | private void doCheatPrompt() { // hack
String input = JOptionPane.showInputDialog(null);
if ("yc with contacts".equals(input)) {
useMask = !useMask;
} else if ("17".equals(input)) {
player.addExp(171717);
player.setMaxHealth(171717);
player.setMaxMana(171717);
player.setHealth(171717);
player.se... |
1aa7d3cb-7a77-4fb0-8bf4-ce30c0e9dde4 | 5 | @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 GatewayAttributeEnumeration)) {
return false;
}
GatewayAttributeEnumeration other = (GatewayAttributeEnumeration) objec... |
146f580c-49d1-4594-b554-ddb297ec2fe2 | 4 | public boolean testUser(String u) throws Exception {
Connection conn =null;
Statement stmt = null;
ResultSet rs=null;
try{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection(url);
stmt = conn.createStatement();
... |
9ea347ea-4fb1-4a50-ab52-d7235d4df7cb | 5 | @Override
public Role findRoleByRoleIdAndAccountId(int roleId, int accountId) {
Role role = null;
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_SELEC... |
123a64e4-f917-4166-b6bc-57c588430c39 | 0 | public void setTerminer(boolean terminer) {
this.terminer = terminer;
} |
f43c02d4-882b-42e0-96a7-1a0aa2d90436 | 2 | public ResultSet execute(String query) {
try {
Statement stm = this.con.createStatement();
if(stm.execute(query)){
return stm.getResultSet();
}
return null;
} catch (SQLException e) {
LogHandler.writeStackTrace(log, e, Level.SEVERE);
return null;
}
} |
13c8365b-4b71-480c-8d9f-5d9aa0682c84 | 1 | public void miseEnMain() {
Peuple p = joueurEnCours.getPeuple();
// Récupération des unités du plateau
Iterator<Territoire> it = p.getTerritoiresOccupes().iterator();
while (it.hasNext()) {
Territoire t = it.next();
int nb = t.getNbUnite();
t.setNbUnite(1);
p.addNbUniteEnMain(nb ... |
ccb8a28b-6ba3-4654-91e6-6d9526bd9f37 | 6 | protected void computeU( int k) {
u.reshape(m,1, false);
double u[] = this.u.data;
// find the largest value in this column
// this is used to normalize the column and mitigate overflow/underflow
double max = 0;
for( int i = k; i < m; i++ ) {
// copy the hou... |
fbcba97f-e03d-409d-85f9-9a0d2055ecc4 | 5 | private boolean isApplicableMethod(Method m, Class<? extends Annotation> httpMethodClass) {
Class<?>[] parameters = m.getParameterTypes();
if(!m.isAnnotationPresent(httpMethodClass))
return false;
if(!(parameters.length == 1 && parameters[0].equals(Arguments.class)))
throw new IllegalArgumentException("Wron... |
7337f09b-f1e0-4005-bd7a-88d43096348e | 0 | public static void main(String[] args) {
w = new Worker();
} |
637d7caa-b4ab-4d3a-9278-8612d029b2c5 | 4 | public void actionPerformed( ActionEvent e )
{
// if any data available
if (TGlobal.projects.getCurrentData() != null)
{
if ( GUIGlobals.PROJECT_PROPERTIES_DIALOG == null )
GUIGlobals.PROJECT_PROPERTIES_DIALOG = new ProjectSettingsDialog() ;
if ( GUIGlobals.PROJECT_PROPERTIES_DIALOG.... |
2995f281-c17f-4898-8ebd-c4239599a669 | 8 | @SuppressWarnings({ "unchecked" })
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String studyPath = req.getPathInfo();
if (studyPath == null) {
resp.sendError(HttpServletResponse.SC_BAD_REQUEST,
"Must specify study path.");
... |
0bbd63f3-4b9d-4086-97b6-3b6b5e1f517b | 0 | public Account getBuyer(){ return buyerInt; } |
1f7f81b3-083e-4b7d-b28c-4f110d70aec6 | 1 | public boolean setProduct(Product product) {
if (product.getStock() == 0) return false;
this.product = product;
quantity = 1;
return true;
} |
86f23125-30fc-43f2-b6cc-38c988808564 | 5 | public int[] getOID(byte type) throws ASN1DecoderFail {
if(data[offset]!=type) throw new ASN1DecoderFail("OCTET STR: "+type+" != "+data[offset]);
byte[] b_value = new byte[contentLength()];
Encoder.copyBytes(b_value, 0, data, contentLength(),offset+typeLen()+lenLen());
int len=2;
for(int k=1;k<b_value.length;... |
48f629b5-9cda-408a-9945-99fb70b7a64f | 4 | protected void updateDisplay() {
System.out.println("HELLO");
cover.repaint();
if (displayedToolIndex >= 1) {
this.startXPosition.setText("" + Math.round(cover.getStartPoint().getX()));
this.startYPosition.setText("" + Math.round(cover.getStartPoint().getY()));
if (displayedToolIndex > 1) {
... |
4411442c-ed9e-486d-81ff-d4d57bf438da | 9 | public Node createNode(SVGGraphWriter writer, Document document,
GraphLayoutCache cache, CellView view, double dx, double dy) {
Rectangle2D bounds = view.getBounds();
Map attributes = view.getAllAttributes();
Element href = (Element) document.createElement("a");
String link = GraphConstants.getLink(attribute... |
fe3ae49a-6781-4bf7-a984-f23d815500f7 | 7 | public ProgressCheckRejectionPolicy(String rejection_policy) {
String policy = rejection_policy.toLowerCase();
if (!policy.startsWith(NAME)) {
throw new IllegalStateException(rejection_policy);
}
policy = policy.substring(NAME.length());
if (policy.startsWith("=")) {
... |
1365ac69-5a31-4d59-9691-1e6b68d132c3 | 0 | public Serie(String nom) {
this.nom = nom;
} |
aaa533ee-3130-4a9b-821c-f43288affda2 | 5 | public static ArrayList<FullTicket> showAll(String status) {
ArrayList<FullTicket> fulltickets = new ArrayList<FullTicket>();
StringBuilder query = new StringBuilder();
Database db = dbconnect();
try {
query.append ("SELECT * FROM full_ticket ");
if (... |
926f83af-c562-42f7-8158-0e24fe0e9d72 | 0 | private Session(String sessionId) {
this.recordActive();
this.sessionId = sessionId;
this.datas = new HashMap<String,Object>();
} |
3fdaa81c-7d26-461b-baf1-a9b0ce55ecf0 | 1 | private void acao102(Token token) throws SemanticError {
try {
String nomeConstante = token.getLexeme();
idAtual = new IdentificadorConstante(nomeConstante, null, null);
tabela.add(idAtual, nivelAtual);
} catch (IdentificadorJaDefinidoException e) {
throw new SemanticError(e.getMessage(), token.getPosit... |
2bbd1f3c-3ace-453b-b5e3-9e6c4f51268c | 8 | public static int[][] matrixMultiply(int[][] a, int[][] b) {
if (a == null || a.length == 0 || b == null || b.length == 0) {
throw new IllegalArgumentException("empty arrays");
}
if (b.length != a[0].length) {
throw new IllegalArgumentException("not compatible arrays");
}
int m = a.length;
int n ... |
99fdbd28-4b14-4729-8381-d67b333681ae | 6 | public void resizePanel(int w, int h) {
if (w == 0 && h == 0) {
//full screen
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
pWidth = dim.width;
pHeight = dim.height;
dbImage = null;
//resize the panel
this.setPr... |
5b2d6b4e-5efb-433f-a9e8-8b7defa53b42 | 9 | synchronized void resizeMap(int x, int y)
{
int i,
i2,
X,
Y;
short newMap[][]= new short[x][y];
X = MapColumns;
if (x < MapColumns)
{
X = x;
}
Y = MapRows;
if (y < MapRows)
{
Y = y;
}
for (i=0;i<X;i++)
{
for (i2=0;i2<Y;i2++)
{
try
{
newMap[i][i2] = shrMap[i][i2... |
c8e832f3-11de-4f14-90fe-0061545d0321 | 8 | @Override
public void keyReleased(final KeyEvent ke) {
switch (ke.getKeyCode()) {
case KeyEvent.VK_UP:
isUP = false;
break;
case KeyEvent.VK_DOWN:
isDOWN = false;
break;
case KeyEvent.VK_LEFT:
isLEFT = false;
break;
case KeyEvent.VK_RIGHT:
isRIGHT = false;
break;
case KeyEvent.VK_CO... |
59de1a2f-d063-4a65-b7aa-cd07c92548a0 | 2 | @Override
public SqlSession getRequestSession() {
SqlSession session = thSession.get();
if (session == null) {
try {
session = MyBatisManager.getDataSessionFactory().openSession();
}catch (Exception ex) {
Logger.getLogger(ThreadLocalRequestData... |
50e42502-e12c-4c7f-a195-ca0df96cf23c | 4 | private void scheduleMatch()
{
clear();
try
{
int matchCount = matchmgr.showCount();
int teamCount = teammgr.showCount();
if (teamCount > 0)
{
int tm = teammgr.getById(1).getGroupId();
if (tm != 0)
... |
9027d279-6abe-407c-9aa3-f4cb56e9fde5 | 0 | public Ginsu() {} |
1b7bacce-2605-4d93-ad78-78b5d7dcb269 | 5 | private Class<? extends GAttrib> attrclass(Class<? extends GAttrib> cl) {
while (true) {
Class<?> p = cl.getSuperclass();
if (p == GAttrib.class)
return (cl);
cl = p.asSubclass(GAttrib.class);
}
} |
e32d939f-1c43-4c08-a4f1-14a264b6bf4f | 3 | public static boolean isEmail(String email)
{
if ((email == null) || (email.length() < 1) || (email.length() > 256)) {
return false;
}
Pattern pattern = Pattern.compile("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
return pattern.matcher(email).matches();
} |
f2ac710b-243d-4d86-b765-6f83efddcf56 | 4 | public ArrayList<String> items(String string){
ArrayList<String> validItems = new ArrayList<>();
List<String> available = Utils.getItemsList();
if(!string.equals("")){
for(String item : available){
if(item.toLowerCase().startsWith(string)){
validItems.add(item);
}
}
}else {
for(String item... |
a453d42a-dce4-4662-9722-5daa904b1c2f | 3 | private void RandomHeader() {
int a = 0;
String Path = null;
String[] PicturesArray = { "Ashe.jpg", "Fiddle.jpg", "Irelia.jpg",
"Jax.jpg", "Karthus.jpg", "Kayle.jpg", "Kayle2.jpg", "LB.jpg",
"Lux.jpg", "Maokai.jpg", "Morgana.jpg", "Morgana2.jpg",
"Noc.jpg", "Swain.jpg", "Vayne.jpg", "Xin.jpg", "Zyra.j... |
3391d433-b392-4c68-9a9f-5b46454c9509 | 1 | private boolean jj_3_14() {
if (jj_3R_32()) return true;
return false;
} |
2ff2a019-a1f3-4352-a26d-41168bc542dc | 4 | public void paintButtons() {
buttonPane.removeAll();
buttonPane.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
textField = new JTextField("port");
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 0;
c.weightx = 0.5;
c.weighty = 0;
c.insets = MainGUI... |
d002ec67-21ab-435e-b31b-02b910098be0 | 3 | public void calcTMmodeEffectiveRefractiveIndices(){
this.effectiveRefractiveIndicesTM = new double[this.numberOfTMmeasurementsPrism];
this.effectiveErrorsTM = new double[this.numberOfTMmeasurementsPrism];
if(this.setTMerrors){
ErrorProp alpha = new ErrorProp(this.prismAngleAlphaRad, ... |
92894905-5053-40fc-b992-a0dfbe78aaab | 9 | public boolean containsValue (Object value, boolean identity) {
V[] valueTable = this.valueTable;
if (value == null) {
K[] keyTable = this.keyTable;
for (int i = capacity + stashSize; i-- > 0;)
if (keyTable[i] != null && valueTable[i] == null) return true;
} else if (identity) {
for (int i = capacity... |
a2286cf3-20b0-4f6e-a3c5-7b715f6ca8c3 | 7 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
// Entering a sub-command without parameters is assumed to be a request
// for information. So display some detailed help.
if (args.length == 0) {
sender.sendMessage(plugin.t... |
baf22003-cc4e-45a3-8190-137bf7b6ece0 | 9 | public void DrawBoard (){
for (int i = 0; i<9;i++){
if (i != 0 && i % 3 == 0){
System.out.println();
System.out.print("-----------");
System.out.println();
}
if (DrawnTTTBoard.isEmpty(i)){
System.out.print(" ");
}
if (DrawnTTTBoard.hasCross(i)){
System.out.print(" X ");
... |
df7309ff-ae35-43b2-a4b2-061231767c34 | 1 | public ShortAnswer(boolean needsAnswer){
prompt = InputHandler.getString("Enter the prompt for your Short Answer question:");
if (needsAnswer){
setCorrectAnswer();
}
} |
5a1491e6-7227-4640-ab76-7e331f2829ac | 9 | private static Stalk_Color_Below_Ring loadStalkColorBelow(String stalk_color_below)
{
if(stalk_color_below.equals("n"))
{
return Stalk_Color_Below_Ring.brown;
}
else if(stalk_color_below.equals("b"))
{
return Stalk_Color_Below_Ring.buff;
}
else if(stalk_color_below.equals("c"))
{
return Stalk... |
eec976cd-5173-48b3-b311-43c6092f8f3a | 2 | @Override
public void run() {
try {
while (true) {
Thread.sleep(1000);
item.setCurrentAnimation(1);
Thread.sleep(1000);
item.setCurrentAnimation(2);
Thread.sleep(1000);
item.setCurrentAnimation(0);
... |
7d37b748-9ab9-4e7b-9bbe-d9fea9f849b8 | 1 | public EncryptedDeck requestEncDeck(User reqUser, EncryptedDeck encDeck)
throws IOException, InterruptedException {
Notification not = new Notification();
encryptedDeck = null;
final Subscription encSub = elvin.subscribe(NOT_TYPE + " == '"
+ ENCRYPT_DECK_REPLY + "' && " + GAME_ID + " == '"
+ gameHost.... |
7652b8cb-7e7a-4777-b1c4-49be0aaf3f45 | 3 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex == 0) {
return sectionNameList.get(rowIndex);
}
if (columnIndex == 1) {
return sectionIdList.get(rowIndex);
}
if (columnIndex == 2) {
return sectionWordsAmo... |
3a66d8a8-755c-4065-ab96-3e1addfdf37b | 5 | public void Stop() throws InterruptedException, IOException {
if (!Running)
return;
Running = false;
Log("Stopping server...");
for(Player p : players)
{
p.sendMessage("Stopping server...");
}
for (Level l : this.getLevelHandler().getLevelList()) {
if (l != MainLevel)
l.Unload(this);
}
Ma... |
6914f3c0-2f27-423f-907a-450b4d835b2e | 9 | public Query handleInsertStatement(ZInsert s, TransactionId tId)
throws DbException, simpledb.ParsingException
{
int tableId;
try {
tableId = Database.getCatalog().getTableId(s.getTable()); // will
// fall
// through if
... |
e40c6d97-0b92-4576-8afb-a5d245113592 | 5 | public long Problem3() {
long n=Long.parseLong("600851475143");
long maior=0;
while(n!=1) {
int i=2;
while (i<=n) {
if (Utility_J.isPrime(i) && n%i==0) {
if (i>maior) {
maior = i;
}
n/=i;
break;
}
i++;
}
}
return maior;
} |
ffd56958-c7de-4274-a491-30b910b00061 | 4 | public boolean checkStatus() {
for (final TextFile availableTextFile : AvailableTextFiles.getInstance().getAvailableTextFiles()) {
try {
final SVNStatus status =
this.svnClientManager.getStatusClient().doStatus(new File(availableTextFile.getAbsolutePath()), true);
if (status != null) {
final SVNS... |
c11d7303-c6c3-4a1b-80ce-e0d6ccbf061d | 8 | private String [] fillArrayAtDo(String [] pullValues){
if(pullValues[2].equalsIgnoreCase("FORCE") && pullValues[3].equalsIgnoreCase("COORDINATES"))
return new String [] {"@DO", "FORCE_COORDINATES", pullValues[1], pullValues[4]};
else if(pullValues[2].equalsIgnoreCase("FORCE") && pullValues[3].equalsIgnoreCase("A... |
10dd8bf6-7f52-4fe6-b5bc-fce682007482 | 3 | public boolean enter(String s, SymtabEntry e) {
boolean isNew = true;
SymtabEntry value = lookup(s);
if (value != null)
if (value.getScope().equals(e.getScope()))
isNew = false;
m.put(s, e);
if (isNew)
l.add(s);
return isNew;
} |
a4a38cea-06ed-459f-a0de-56c4fd1a65ca | 8 | private void processType(String alias, String description)
{
// get type
Type type = this._typeManager.getType(alias);
// apply superclass
if (this._extendsTypes != null && this._extendsTypes.size() > 0)
{
// TODO: Only supporting single inheritance
Type superClass = this._extendsTypes.get(0);
... |
a204485f-2e5c-4454-b7a9-a6d5d919f932 | 0 | public static void main(String[] args) {
Base base = getBase(47);
base.f();
} |
71ef12df-aa7f-416b-9235-867afa168244 | 0 | public UserRemovalFinalized(User user)
{
this.user = user;
} |
65d99e56-d049-47d2-a0e7-590e48b28cbf | 9 | ArchiveLoader(int i, FileIndex class137, FileIndex class137_23_, OndemandWorker requester, FileIndexWorker class112, int i_24_, byte[] is, int i_25_, boolean bool) {
requestTable = new HashTable(16);
anInt6373 = 0;
requestsDeque = new Deque();
aLong6374 = 0L;
do {
try {
indexId = i;
fileIndex = class137;
... |
81af1f30-5bda-45f6-a9c1-b40bdadd1a70 | 4 | public void setGrid(Grid grid) {
this.grid = grid;
Slot[][] newCells = new Slot[grid.getNumRows()][grid.getNumColumns()];
for (int r = 0; r < grid.getNumRows(); r++) {
for (int c = 0; c < grid.getNumColumns(); c++) {
if (r < cells.length && c < cells[0].length) {
... |
9deee9d7-9a0c-4b39-9e40-b0fc38debb16 | 4 | public void save()
{
//W klasie docelowej należy sprawdzić, czy row.isEmpty()
//jeśli tak, to należy nadać nazwę tabeli, do ktrej zostanie wstawiony wiersz
//należy to zrobić za pomocą row.setTableName(<nazwa>);
//Dopiero potem należy wywołać save z klasy bazowej
if(row.isEmp... |
c50f0994-2657-4c4d-8c69-d7f645e0e97d | 0 | public int getPerimeter() {
return 4 * side;
} |
9d61ecb6-97fa-4dba-923c-b712e09677b9 | 1 | public long getLong(String key) throws JSONException {
Object o = get(key);
return o instanceof Number ?
((Number)o).longValue() : (long)getDouble(key);
} |
59a5d298-67a0-443b-bf8a-81ddc29d908c | 2 | private long calcSSD (int[] org, int[] dec, int width, int height) {
long ssd = 0;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int diff = org[y * width + x] - dec[y * width + x];
ssd += diff * diff;
}
}
ret... |
5e2f16f7-ca2b-4692-af2a-50a1e14c197a | 4 | private void handleCommon(HTMLComponent comp) {
currentPage.addChild(comp);
if (currentPage != currentContainer()) {
currentContainer().addChild(comp);
}
if (comp instanceof HTMLContainer) {
pushContainer((HTMLContainer)comp);
}
if (comp instanceof HTMLInput && currentForm != null) {
((HTMLFormImpl... |
5a36eb62-7419-49e7-a359-7dc4173b3e31 | 2 | public void setPrismAngleAlpha(double angle){
this.prismAngleAlphaDeg = angle;
this.prismAngleAlphaRad = Math.toRadians(angle);
this.setPrismAlpha = true;
if(this.setMeasurementsPrism && this.setPrismRI)this.calcEffectiveRefractiveIndices();
} |
09cea4c2-e592-471b-811e-68e54c602a6a | 1 | private void compute_pcm_samples13(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[13 ... |
73d41a07-a743-448e-9e76-3db8dc4af912 | 6 | public static void main(String[] args) {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
boolean[][] nabomatrise = new boolean[n][n];
String naboRad;
for(int i=0;i<n;i++){
naboRad=in.readLine();
for(int j=0;j<n;j++)
... |
83b0ce0c-acfb-4d70-81fa-5f1313070971 | 6 | public GUIController(WorldFrame<T> parent, GridPanel disp,
DisplayMap displayMap, ResourceBundle res)
{
resources = res;
display = disp;
parentFrame = parent;
this.displayMap = displayMap;
makeControls();
occupantClasses = new TreeSet<Class>(new Comparato... |
78aff74c-9cf5-4176-8c52-ed2eb7ace62c | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Volume other = (Volume) obj;
if (this.value != other.value) {
return false;
}
... |
14a7ce16-1b88-42b5-8317-4a45b1e5af7d | 6 | public List<List<String>> getRecords(String fundCode) throws IOException {
if(records == null){
records = new HashMap<String, List<List<String>>>();
}
if(records.size() > RECORDCACHESIZE){
records.clear();
}
if(!records.containsKey(fundCode)){
List<List<String>> record = null;
try {
record... |
d20ca966-0b4c-45df-8e07-9b64f8bbb1ac | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ResourceHand other = (ResourceHand) obj;
if (brick != other.brick)
return false;
if (ore != other.ore)
return false;
if (sheep != other... |
5490bfe5-122f-4356-a634-72658b28e4f8 | 3 | public static void updateYellow() {
for (int i = 0; i < yOrgs.size(); i++) {
Organism g1 = yOrgs.get(i);
g1.move();
for (int j = i + 1; j < yOrgs.size(); j++) {
Organism g2 = yOrgs.get(j);
if (g1.getDist(g2) < 40) {
g1.closeTo(g2);
}
}
}
} |
d724dc60-fb38-4ba9-bf45-74bf283fcde3 | 9 | public static void main(String args[]) {
boolean[] isPrime = EulerMath.getSieve(1_000_000);
int total = 0;
for(int i = 10; i < isPrime.length; i++)
if( isPrime[i] ) {
boolean add = true;
int x = i;
int numDigits = 0;
// Removes least significant
while( add && x > 0 ) {
if( isPr... |
5dc98af3-9e07-45ab-a5a6-68cedf05cc54 | 0 | public static void main(String[] args) {
Detergent x = new Detergent();
x.dilute();
x.apply();
x.scrub();
x.foam();
System.out.println(x);
System.out.println("Testing base class:");
Cleanser.main(args);
} |
67345692-cf60-4d55-a049-5f6035fce6f2 | 8 | public String longestCommonPrefix(String[] strs) {
if (strs == null || strs.length == 0)
return "";
int num = strs.length;
if (num == 1)
return strs[0];
int len1 = strs[0].length();
String prefix = "";
for (int i... |
e0ad74db-bd70-4f37-84ef-106dd554f790 | 8 | public void warn(Event event) {
switch(event.getTypeEvent())
{
case SHUTDOWN :
stop();
break;
case PLAYMUSIC_END :
end = true;
break;
case GOFORWARD_END :
state = 1;
robotMoving = false;
break;
case GOBACKWARD_END :
state = 2;
robotMoving = false;
break;
case ROTATE_END :
... |
6e2a537e-d3f9-40a8-a784-a34ea5303477 | 7 | public int overlapEnd(int start, int end) {
if (start >= end) throw new IllegalArgumentException("The end " + end + " should be greater than start " + start);
IntervalNode intervalNode = root;
if (root == null || start >= root.maxEnd || end <= root.start)
return -1;
while (... |
74882d8e-9404-4e29-a75c-774bb78063b2 | 3 | public BufferedImage captureScreen()
{
File oDir = new File("");
String sDirectory = "";
String sPathSeparator = "";
if (!sDirectory.endsWith(File.separator))
{
sPathSeparator = File.separator;
}
try{
sDirectory = oDir.getCanonicalPath();
}
catch (IOException ex){
System.out.prin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.