method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4c52f949-c386-4ec1-a1fd-c73349596430 | 6 | private String getMatch(String s) {
for (int i = 0; i < dataList.size(); i++) {
String s1 = dataList.get(i).toString();
if (s1 != null) {
if (!isCaseSensitive
&& s1.toLowerCase().startsWith(s.toLowerCase()))
return s1;
if (isCaseSensitive && s1.startsWith(s))
return s1;
}
}
retur... |
be7ec003-20b0-4883-8bed-27e29fc7107f | 5 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
RaavareDTO raavare = raavareList.get(rowIndex);
Object value = null;
switch (columnIndex) {
case 0:
value = raavare.getRaavareId();
break;
case 1:
value = raavare.getVareNavn();
break;
case 2:
value = raavare.getLeverandoerI... |
0bf6fbae-2da5-4e0d-bed9-780ee3b442b0 | 4 | private int[] generateTestingArray() {
Random r = new Random();
int arraySize = (Integer) spinnerArraySize.getValue();
int[] values = new int[arraySize];
for (int i = 0; i < values.length; i++)
values[i] = r.nextInt(SAVHistoryComponent.PLAYING_CARD_AMOUNT);
if (this.rdbtnSorted.isSelected()) {
Arrays... |
0e30bb4d-e013-4ceb-a13c-9869f5f9ae45 | 8 | @SuppressWarnings("unchecked")
void readMolecularOrbitals() throws Exception {
Hashtable[] mos = new Hashtable[5];
Vector[] data = new Vector[5];
int nThisLine = 0;
while (readLine() != null
&& line.toUpperCase().indexOf("DENS") < 0) {
String[] tokens = getTokens(line);
int ptData = ... |
72e7890a-043d-4de8-8753-4ce6077eee3c | 3 | @Override
public Consulta listByIdUpdate(int codigo) {
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Consulta c = new Consulta();
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(LISTBYIDUPDATE);... |
cdd7ffc7-b23d-4f69-b552-1f65797477e2 | 9 | public void initChatGroup() {
String sessionId = getSession().getId();
checkUserRegister(getRequest(), sessionId);
int selfChatState = UserState.dao.getUserState(sessionId);
if (selfChatState == Users.onlineWithoutChat || selfChatState == Users.offLine || selfChatState == Users.unExist) {
UserState.dao.updat... |
30770662-4a15-47d2-bc6e-72280c7304cd | 2 | @Override
public boolean matches(String[] input) {
for (String word: input) {
if (word.equals("test")) {
return true;
}
}
return false;
} |
63ca2ff0-311d-4890-8b62-a5bd78d0b02e | 8 | @Override
public boolean isBuffered() {
//if(gcode==null) return false;
if (Constants.GCDEF.G0.equals(gcode) || Constants.GCDEF.G1.equals(gcode) || Constants.GCDEF.G2.equals(gcode) || Constants.GCDEF.M106.equals(gcode) || Constants.GCDEF.M107.equals(gcode) || Constants.GCDEF.G30.equals(gcode) || Constants.GCDEF... |
cccdcebb-7938-4745-aeda-ce79b649fddb | 2 | public static int strxtoi(String hex)
{
final int ASCII_CUTOFF_INTS = 48;
final int ASCII_CUTOFF_LETTERS = 65;
final int ASCII_SUBTRACT_LETTERS = 55;
final int BASE = 16;
int sum = 0;
for(int i = 0 ; i < hex.length() ; i++){
sum *= BASE;
int val = (int) hex.charAt(i);
if(val >= ASCII_CUTOFF_LETTER... |
daa30cc6-b17e-4f2e-ae68-8d8193377de8 | 0 | public int getMaxHP() {
return maxHP;
} |
1f7b1538-fa4d-4fcf-b5ee-8d418229a9d3 | 3 | protected synchronized void paintComponent(Graphics g2) {
if(!animate_) {
return;
}
super.paintComponent(g2);
Graphics2D g2D = (Graphics2D)g2;
g2D.setFont(grFont);
double timeSpan = settings.getTimeSpan();
panelHeight_ = pnLeft.getHeight() - 100 - SHI... |
981e2f77-3b2b-460e-b5d0-a884d07bf349 | 3 | @Override
public void removeLayoutComponent(Component component) {
if (defaultComponents.contains(component)) {
defaultComponents.remove(component);
}
if (bottomComponents.contains(component)) {
bottomComponents.remove(component);
}
if (bottomCenter.contains(component)) {
bottomCenter.remove(compone... |
df2f0d43-979f-43b3-b4ab-b66e46e8a9b7 | 6 | public static List<?> GetAll(Class aClass) {
if (aClass.equals(Transaction.class))
return allData.getAllTransactions();
if (aClass.equals(Transfer.class))
return allData.getAllTransfers();
if (aClass.equals(ExpenseCategory.class))
return allData.getAllExpenseC... |
20e290ba-6ed8-463c-b99b-0524863eb4d2 | 0 | @Override
public String getElementAt(int index) {
// TODO Auto-generated method stub
return names[index];
} |
38ad4090-d0a4-4ef8-a0c0-32bec33cfe42 | 9 | public void method212(boolean flag, int j, int k, int l, int i1, int j1)
{
int k1 = 256;
if(flag)
k1 += 0x20000;
l -= anInt290;
i1 -= anInt291;
if(j1 == 1 || j1 == 3)
{
int l1 = j;
j = k;
k = l1;
}
for(int i2 = l; i2 < l + j; i2++)
if(i2 >= 0 && i2 < anInt292)
{
for(int j2 = i1; j... |
3be7074c-08bc-409c-8b1f-2b39e31d15ec | 2 | public boolean equals(final Object obj) {
if (obj instanceof Key) {
final Key key = (Key) obj;
return (key.node == node) && (key.blockIndex == blockIndex);
}
return false;
} |
58071e7e-cfef-4640-97fa-9de67a593bf9 | 9 | private void parseBounds(RdpPacket_Localised data, BoundsOrder bounds)
throws OrderException {
int present = 0;
present = data.get8();
if ((present & 1) != 0) {
bounds.setLeft(setCoordinate(data, bounds.getLeft(), false));
} else if ((present & 16) != 0) {
... |
28caf12c-309a-4b18-b1ad-89da457dce13 | 9 | public static void main(String... args)
{
int nodeNumber = 3; //number of nodes in the network
int initialPort = 8000; //initial UDP port
String userNamePrefix = "TestUser"; //userId common prefix
/*
* PART I : Network initialization
*/
//Create the environ... |
80febccf-bc6d-487f-ac03-8232041ad19b | 5 | private static BigDecimal regraC(Transferencia transf) {
long dias = calculaDiasEntreDatas(transf.getCreated(), transf.getAgenda());
BigDecimal valRetorno = null;
if (dias > 30) {
valRetorno = transf.getValor().multiply(new BigDecimal("0.012"));
} else if (dias > 25) {
... |
a0dbe163-b7a3-49ec-a164-fbcd1e7afe7c | 7 | private Object newInstance (Class type) {
try {
return type.newInstance();
} catch (Exception ex) {
try {
// Try a private constructor.
Constructor constructor = type.getDeclaredConstructor();
constructor.setAccessible(true);
return constructor.newInstance();
} catch (SecurityException igno... |
7e323b19-4764-4018-a0b3-3c6475ea0823 | 2 | private void CriarEscola_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CriarEscola_ButtonActionPerformed
if (NomeEscola_TextField.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Escreva um nome para a escola!", "Alerta!", JOptionPane.WARNING_MESSAGE);
... |
89438f2d-3dc9-4552-b9d8-d385fe6046bc | 0 | public String getNom() {
return nom;
} |
b48c5421-a7d1-4b7d-83de-dee04843798a | 6 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
DefaultTableModel dft = (DefaultTableModel) jTable3.getModel();
dft.setRowCount(0);
if (jRadioButton2.isSelected()) {
try {
... |
f281d189-c868-4e2d-9885-7a5a970dfccf | 6 | private Expr statement() throws IOException {
if (lookAheadToken.tag == '(' || lookAheadToken.tag == Tag.NUM || lookAheadToken.tag == Tag.REAL) {
expression();
Expr t = e.gen();
return t.reduce();
} else if (lookAheadToken.tag == Tag.ID) {
Token temp = lo... |
48359832-d49e-4e6a-ab3e-e7a4a285bb98 | 3 | private static LinkedList<CommMode> parseComm(String path)
throws ParserConfigurationException, SAXException, IOException {
// xml get root
Document partXml = XmlReader.getDoc(path);
Node partNod = partXml.getDocumentElement();
Element partElem = (Element) partNod;
// the return
LinkedList<CommMode> ret ... |
61907575-e017-4332-ad9f-394f2b33ebae | 6 | public double getResult(String expressionCode)
{
StringBuffer expression2 = new StringBuffer();
String expression = (String)hashExpressions.get(expressionCode);
int i = 0;
int lastPoz = 0;
for(; i < expression.length(); i++)
if(i == expression.length() - 1 || Oper... |
631c67ef-4a3d-499c-86b6-e76504631453 | 1 | @Override
public int read() throws IOException {
if(bList.isEmpty()) {
return -1;
} else {
//Damn the signed bytes
return bList.pollFirst()&255;
}
} |
9f13629e-0c66-4de1-ac07-613e0044efeb | 5 | private static String encode_base64(byte d[], int len)
throws IllegalArgumentException {
int off = 0;
StringBuffer rs = new StringBuffer();
int c1, c2;
if (len <= 0 || len > d.length)
throw new IllegalArgumentException ("Invalid len");
while (off < len) {
c1 = d[off++] & 0xff;
rs.append(base64_co... |
8e52204e-0558-4595-8f71-6a52defec870 | 7 | public static void combSort11(double arrayToSort[], int linkedArray[]) {
int switches, j, top, gap;
double hold1; int hold2;
gap = arrayToSort.length;
do {
gap=(int)(gap/1.3);
switch(gap) {
case 0:
gap = 1;
break;
case 9:
case 10:
gap=11;... |
7ae8d11b-fd12-40d6-944b-31ea5da08fbe | 9 | public static Map<Marker, Marker> collapseZeroGap(Markers markersOri) {
Map<Marker, Marker> collapse = new HashMap<Marker, Marker>();
// Sort markers by start
Markers sorted = new Markers();
sorted.add(markersOri);
sorted.sort(false, false);
// Create new set of markers
Marker markerPrev = null; // Pre... |
cdd9f2af-cc9d-4026-a86a-4654ebc25176 | 4 | private void setGameCheck(Game game) {
for (int y = 0; y < 9; y++) {
for (int x = 0; x < 9; x++) {
fields[y][x].setBackground(Color.WHITE);
if (fields[y][x].getForeground().equals(Color.BLUE))
fields[y][x].setBackground(game.isCheckValid(x, y) ? Co... |
c3ca24cb-862f-4fe3-a587-180992c50741 | 4 | @Nullable
public T waitForResult() throws InterruptedException {
if(!set) {
synchronized (waitLock) {
if(!set) {
waitLock.wait();
}
}
}
if(!set) {
throw new IllegalStateException("Notified but never set: " + this);
}
try {
//noinspection unchecked
return (T)result;
} catch (Cla... |
10ba2bd3-8c3a-49a9-9bcd-fa3cbe5a126d | 9 | * @param unit The <code>Unit</code> that is building.
* @param name The new settlement name.
* @return An <code>Element</code> encapsulating this action.
*/
public Element buildSettlement(ServerPlayer serverPlayer, Unit unit,
String name) {
ChangeSet cs = ne... |
f60ce16d-dd84-4015-aa81-b9a08b5c72d2 | 9 | private void restoreTree(List<Component> roots, Map<String, Object> stateMap) {
List<Component> allChildren = new ArrayList<Component>();
for (Component root : roots) {
if (root != null) {
PropertySupport p = getProperty(root);
if (p != null) {
... |
2648872b-13ca-4982-81ee-59dca649532b | 0 | public String getSaveEncoding() {
return (String) saveEncodingComboBox.getSelectedItem();
} |
4567e5f9-a5d4-458f-9111-6d10618709e9 | 4 | private void cargaBDF(BufferedReader bf) throws IOException
{
String linea;
int indice;
double x,y,z,w;
Nodo nodo;
Elemento elemento;
do
{
linea = bf.readLine();
if(linea.startsWith("GRID"))
{
indice = Integ... |
360d1e4c-c3dc-4620-a1be-ac8d904d0c77 | 6 | @EventHandler
public void WolfNightVision(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.getWolfConfig().getDouble("Wolf.NightVisi... |
774a342a-6a49-4bfe-bd00-4f9ac588ea03 | 1 | public void visitArrayRefExpr(final ArrayRefExpr expr) {
// NullPointerException, ArrayIndexOutOfBoundsException,
// ArrayStoreException
sideEffects |= SideEffectChecker.THROW;
if (expr.isDef()) {
sideEffects |= SideEffectChecker.STORE;
}
sideEffects |= SideEffectChecker.ALIAS;
expr.visitChildren(th... |
70ffa726-9024-43a3-9c82-6f526c8f15fb | 1 | @Override
public final void write(final String text) {
if (text == null) {
System.out.println(INVALID_STRING);
return;
}
System.out.println(text);
} |
9e4c89e5-c9e9-4c65-99dc-67811b44ff60 | 5 | public void draw(GOut g) {
if(state == 0)
g.chcolor(255, 192, 192, 255);
else if(state == 1)
g.chcolor(192, 192, 255, 255);
else if(state == 2)
g.chcolor(192, 255, 192, 255);
g.image(bg, Coord.z, sz);
g.chcolor();
if((state & 1) != 0)
g.image(ol, Coord.z, sz);
else
g.image(sl, Coord.z, s... |
f0dfa0c8-af86-4ae5-a4bf-4871a866445d | 0 | public static void main(String[] args) {
Game game = new Game();
game.setVisible(true);
game.setResizable(false);
} |
a2929305-70f8-4026-ad17-7f2f9ca69538 | 7 | private void registerListener(Object o) {
Class<?> clazz = o.getClass();
Method [] methods = clazz.getDeclaredMethods();
for (Method m : methods) {
if (m.isAnnotationPresent(EventCallback.class)){
EventCallback cb = (EventCallback) m.getAnnotation(EventCallback.class);
if (cb.ignore()) continue;
... |
d62f6e84-9cd6-4d42-aa6e-ebf87f46a072 | 5 | public boolean isNumeric() {
return (this == BYTE || this == SHORT || this == INTEGER
|| this == LONG || this == FLOAT || this == DOUBLE);
} |
f870a26b-fde1-4abf-9d95-9bf46645c749 | 4 | public List<TopicObj> getTopicTable(PreparedStatement pre, boolean join) {
List<TopicObj> items = new LinkedList<TopicObj>();
try {
ResultSet rs = pre.executeQuery();
if (rs != null) {
while (rs.next()) {
TopicObj item = new TopicObj();
... |
249add7a-516d-4238-bf58-fa1a0e3db4a0 | 1 | protected AbstractDefinition(Method method) throws DaoGenerateException {
// 如果不传入method,则表示子类会自己根据需要,延迟初始化
if (method != null) {
initDefinition(method);
}
} |
c9fb693d-62aa-4cf0-b658-24c6f37d7489 | 5 | public CheckResultMessage check15(int day) {
int r1 = get(33, 5);
int c1 = get(34, 5);
int r2 = get(36, 5);
int c2 = get(37, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r2 +... |
a1e29e01-b3a4-4471-bfb1-0a8d4e7bd1d9 | 3 | private void directionOrThrow(String direct) {
boolean dire = direct.equals(UNDIRECTED) || direct.equals(DIRECTED);
if (!dire)
try {
throw new IOException(
"No Direction Found at first line of given File!");
} catch (IOException e) {
}
} |
49fc9282-8ca1-4043-8d08-e12d2eceb457 | 9 | public final boolean method53(int i, Interface14 interface14) {
anInt4994++;
if (!(interface14 instanceof Class126))
return false;
Class126 class126_3_ = (Class126) interface14;
if (((Class126) this).anInt4991 != ((Class126) class126_3_).anInt4991)
return false;
if (i <= 50)
return true;
if (((Clas... |
4985c8c4-2ac1-49b3-be95-d238bf905e31 | 4 | private static void startSession() {
Session session = Session.getInstance(true);
Pair<BigInteger, BigInteger> privateKeys = session.getPrivateKey();
System.out.println("");
System.out.println("Private key x: " + privateKeys.getFirst());
System.out.println("Private key y: " + privateKeys.getSecond());
Sys... |
4ddfb2b4-a839-4392-88bc-921089f13f6e | 9 | final void method2964(byte i, OggPacket oggpacket) {
anInt8990++;
if ((((Class348_Sub23) this).anInt6868 ^ 0xffffffff) > -4) {
int i_7_ = aVorbisInfo9006.headerIn(aVorbisComment9002, oggpacket);
if (i_7_ < 0)
throw new IllegalStateException(String.valueOf(i_7_));
if (((Class348_Sub23) this).anInt6868... |
de2e6347-b819-4d87-9a57-5dfd01b31666 | 1 | public static void main(String... args) {
int[] array = {-1, 12, 34, 123, 435, 9876, 0};
sort(array);
for (int i = 0; i < array.length; i++) {
System.out.println(array[i]);
}
} |
494d9da8-f420-45e3-9097-e51c028ca2f0 | 5 | public StringBuilder save() {
StringBuilder data = new StringBuilder();
data.append(totalText.getText().substring(0, totalText.getText().indexOf(' ')));
for(int x = 0; x<swingTimes.length; x++) {
data.append(";" + swingTimes[x]);
}
data.append(System.getProperty("line.separator"));
int i = 0;
if(... |
67b622c3-41dc-495a-8f09-9e8ea8012143 | 3 | public String kertaaTama(int index){
String palautettava = "";
if (tila==KertausmaatinTila.TYHJA) {
palautettava += kerrattavat.get(index)[0]; //näytä kanji
tila = KertausmaatinTila.KANJI;
} else if (tila == KertausmaatinTila.KANJI) {
palautettava = kerrattava... |
bddefaa8-133d-4136-95d8-f4f1efd07d52 | 6 | @Override
public boolean isLessThan(CardInterface card, int trump) {
boolean retval;
if (this.value == 0) {
// fool will never get the trick if it wasn't the first card played
if (card.getValue() == 0) {
retval = false;
} else {
ret... |
09afeec1-33e0-49fa-9867-0dcc428eb375 | 5 | public HashMap<String, Object> Match(String rank, String name, boolean strict, boolean verbose,
Map<String, String> taxonomy) {
String urlString = "http://api.gbif.org/v1/species/match?verbose=true";
URL url;
URLConnection conn;
InputStream is;
if(strict)
urlString += "&strict=true... |
745482ab-cac0-4697-965b-e067a1463f8f | 3 | private boolean testEventListEquality(boolean ignoreMachine, List<Event> firstEvents, List<Event> secondEvents) {
if(firstEvents.size() != secondEvents.size()) {
return false;
}
for(int i=0; i<firstEvents.size(); i++) {
if(!eventAreEqual(ignoreMachine, firstEvents.get(i), secondEvents.get(i))) {
return... |
1e528f85-cecb-4ad7-ad11-4c7ec6cb29e7 | 8 | private void compute()
{
double[] weights = model.getWeights();
double wscale = model.getWscale();
// Unlike the C++ code in sgd, we would like to be RAII
assert (u == null && b == null);
int nPos = sequence.length();
u = new double[nPos][numLabels];
for (int... |
bf06f9d2-06bc-40e8-8271-5c9ff1eed8c8 | 2 | public int getTopX(){if(dir=='u'||dir=='d')return x-17; return x-30;} |
0aa86abe-fccc-4fee-8241-31c5f2635952 | 8 | private static void readFilename(FileSystem fileSystem, String file, byte[] cmp) throws TestFailedException {
FileHandle handle;
try {
handle = fileSystem.openFile(file, true, true);
} catch (PathNotFoundException e) {
throw new TestFailedException(e);
} catch (AccessDeniedException e) {
throw new Test... |
5019c60e-4c5e-4937-a603-9d134377db39 | 9 | private static void buildIndex(String dataFile) {
System.out.println("Building Index ... ");
String indexFile = dataFile + ".idx";
try {
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader(new FileReader(dataFile));
String line = null;
String tmp = null;
long offset = 0;
... |
1ed1ee35-8360-4c89-a80e-e54d4898ff72 | 2 | @Override
public void actionPerformed(ActionEvent e) {
if(time == 7) t.stop();
System.out.println();
time++;
for(Line line : l)
line.split();
repaint();
} |
5a03e823-70a5-4e38-bc09-00f42dd1152c | 8 | public static void modifyType(ArrayList<Journal> journalList, JournalTypes journalTypes) {
boolean singleMove;
if (journalList.size() == 1) {
singleMove = true;
} else {
int option = JOptionPane.showConfirmDialog(null, getBundle("BusinessActions").getString("APPLY_SAME_T... |
5260c568-eed6-4763-a34c-499895e48935 | 2 | void checkModify() throws RuntimeException {
if (isFrozen()) {
String msg = getName() + " class is frozen";
if (wasPruned)
msg += " and pruned";
throw new RuntimeException(msg);
}
wasChanged = true;
} |
4038d4cb-6ae1-4d84-8e3d-28da75769161 | 0 | public void setTytul(String tytul) {
this.tytul = tytul;
} |
65a718eb-84cb-4834-b09f-c8e61724dbb6 | 2 | public ArrayList<Integer> getPathTo(Node target) {
if(getShortestPathTo(target) == INFINITY)
return null;
else
{
// System.out.println("From " + source + " to " + target);
int p = target.getId();
ArrayList<Integer> result = new ArrayList<>();
result.add(p);
do{
p = pred[p];
result.add(p);... |
8d28cfab-7c5e-4dfe-8b60-49f5fd5249c0 | 4 | public void checkCollision() {
for(int y = 0; y <mg.getMapSize().getY(); y++){
for(int x = 0; x <mg.getMapSize().getX(); x++){
if(mg.getCol()[x][y]){//Ends loop if not collision square
if(player.getColRect().intersects(new Rectangle(mg.getTileSize().getX()*x, mg.getTileSize().getY()*y,
mg.getTileSi... |
bfdb412e-b83e-4fa0-a9a6-6dee9a2c7349 | 9 | public byte[] post(String url, Map<String, String> postParams)
throws HttpException {
int numRetries = retry ? maxRetries : 1;
HttpPost httppost = null;
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
if (postParams != null && !postParams.isEmpty()) {
for (Map.Entry<Stri... |
54687fbb-b56e-44f8-8654-1c8cab0e654e | 5 | @Override
public void show() {
Auction a = null;
System.out.println(name + ", type in the required information for a new auction item." + "\n");
System.out.println("Name of product:");
try {
productName = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("De... |
fe6b8e0b-25f8-4a5f-94e1-d87223e95cfd | 3 | private void reconnect() {
if (this.reconnecting) return;
final Manager self = this;
this.attempts++;
if (attempts > this._reconnectionAttempts) {
logger.fine("reconnect failed");
this.emitAll(EVENT_RECONNECT_FAILED);
this.reconnecting = false;
... |
6216fd63-37a8-4ca4-8785-d34b833f12b2 | 2 | @Override
public Properties getOutputProperties() {
Properties properties = new Properties();
properties.put(NAME, getName());
properties.put(Balances.LEFTNAME, leftName);
properties.put(Balances.RIGHTNAME, rightName);
properties.put(Balances.LEFTTOTALNAME, leftTotalName);
... |
f1e00e34-6fef-49f4-920e-f2769d45d46e | 5 | @Override
public boolean equals(Object o) {
if(this == o) {
return true;
}
if(o == null || getClass() != o.getClass()) {
return false;
}
PlayerData playerData = (PlayerData) o;
if(id != playerData.id) {
return false;
}
if(!name.equals(playerData.name)) {
return false;
}
return true;
... |
d60bb8b4-c98b-44d8-bb75-fad35d2ba3f8 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UsersSubscribeHashtags that = (UsersSubscribeHashtags) o;
if (hashtagId != that.hashtagId) return false;
if (userId != that.userId) return fals... |
2002f778-f1ce-4899-9026-d589b8827c68 | 7 | public static final boolean fullDharokEquipped(Player player) {
int helmId = player.getEquipment().getHatId();
int chestId = player.getEquipment().getChestId();
int legsId = player.getEquipment().getLegsId();
int weaponId = player.getEquipment().getWeaponId();
if (helmId == -1 || chestId == -1 || legsId == -1... |
48bcc569-d882-4bc8-a02f-9c1aefbdc275 | 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 TaxonObservationFilterElement)) {
return false;
}
TaxonObservationFilterElement other = (TaxonObservationFilterElement)... |
2aa3d5c6-3f89-42c3-9f2f-b3bd5d8d41b1 | 3 | @Override
public Comment getComment(int id)
{
/*
* gets a comment we a specific ID
*/
Comment comment = null;
Session session = null;
try {
session = factory.openSession();
session.beginTransaction();
comment = (Comment) session.get(Comment.class, id);
session.getTransaction().commit();
}... |
a7232c72-6f50-409f-a4d9-49ea677948c7 | 1 | @Test
@SuppressWarnings({"unused", "null"})
public void testRecommendation() throws Exception {
String filename = Common.DATASET_FILENAME;
// First concept : a data model holds all the data.
// Instantiate here, a file based data model.
DataModel dataModel = null;
// Second concept : a similarity allo... |
342fe36d-6531-46e1-85a2-853f3e051e82 | 8 | public static void insert(String eDatabase, String table, byte[] etuple, String VALUES){
Connection gCon = null; // general connection to MYSQL
Connection eCon = null; // connection to database
Statement eStatement = null; // statements for the eDatabase
try{
// Register JDBC driver
Class.forName... |
d163c62b-2102-469c-a621-9635ca401502 | 3 | private JSONWriter end(char mode, char c) throws JSONException {
if (this.mode != mode) {
throw new JSONException(mode == 'a'
? "Misplaced endArray."
: "Misplaced endObject.");
}
this.pop(mode);
try {
this.writer.write(c);
}... |
747658d2-8e43-4bbd-9182-4c348c600de5 | 2 | private static String rmvPrePostSc(String target) {
final char SC = '\'';
// ' で囲まれていた場合のみ、削除する。
if(target.charAt(0) != SC || target.charAt(target.length() -1) != SC)
return target;
//前後1文字づつ削除
return StringUtils.substring(target, 1 , target.length() -1 );
} |
633bf2d1-cf86-493c-8302-677d38971319 | 3 | private Color[] calculateColorPoints(int numberOfPoints,
Point2D.Float startPoint,
Point2D.Float endPoint,
float t0, float t1) {
// calculate the slope
float m = (startPoint.y - end... |
fa2deb76-9495-4aa8-ba52-e5c78cf1eac8 | 1 | public void ouvrirEcriture(){
try{
// PrintWriter avec un auto flush sinon bloquant.
// directement le flux logique.
pf = new PrintWriter(s.getOutputStream(),true);
// alternative
// PrintStream ps = new PrintStream(s.getOutputStream());
}catch(IOException io){
System.out.println("echec de l'... |
249e6f77-ea74-461d-924c-ad2fb4102b50 | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE)... |
bbe150b6-c8ea-4ed4-800a-e26a73b61ccf | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
dd7624e4-11f1-49d5-a31d-21bf3cdcf72f | 7 | public void updateColumnInfos() {
if (this.getData() == null || this.getData().size() == 0) return;
int colCnt = this.getData().get(0).length;
initColInfoIfNull(colCnt);
for (ColumnInfo ci : getColumnsInfos()){
ci.setMaxValue(Double.MIN_VALUE);
ci.setMinValue(Do... |
487d456b-3e3a-402a-9ca2-256dac303dd6 | 8 | @Override
public boolean equals(Object o) {
if (o instanceof Pair<?, ?>) {
Pair<?, ?> p = (Pair<?, ?>) o;
return a.equals(p.a) && b.equals(p.b);
}
return false;
} |
1ce5f10d-0516-497c-bdd7-96523dd537f0 | 3 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int length = Integer.parseInt(in.readLine());
String[] strArray = in.readLine().split(" ");
int[] array1 = new int[length];
int[] array2 = new int[length];
for (int i = 0; i... |
c06121ce-b208-4fcb-ae02-c25b2decec5b | 6 | public static int RoomService(Client joueur) {
int tempDette = 0;
int choiceInt = -1;
boolean wrong = false;
System.out.println("Que voulez vous prendre?"
+ "\n pour de la nourriture tapez 1 (50€)"
+ "\n pour de la boisson tapez 2");
do {
... |
634f756a-8f6e-427d-8ded-27220a251581 | 6 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
switch (displayedToolIndex) {
case 1:
if (this.getComponentCount() == 0) {
this.add(imageIcon);
}
imageIcon.setLocation(new Point((int)startPoint.getX()-12, (int)startPoint.getY()-12));
break;
case 2:
if ... |
cbac782a-7680-4433-9c3a-985511b2773d | 9 | public void updatePosition() {
if (xPos < xDestination){
prevXPos = xPos;
xPos++;
} //xPos = xPos + 2;
else if (xPos > xDestination){
prevXPos = xPos;
xPos--;
} //xPos = xPos - 2;
if (yPos < yDestination){
prevYPos = yPos;
yPos++;
... |
6c5d65e5-3b2e-436e-ba34-08e2f603bb80 | 5 | public void solve(){
BoardState cState = sState;
visitedList = new ArrayList<BoardState>();
frontierList = new LinkedBlockingQueue<BoardState>();
long startTime, endTime, totalTime; //for time keeping
startTime = System.nanoTime();
while (cState != null && !cState.equals(eState)){ //stop if all nodes explor... |
fef35ffb-3719-44c2-a22b-f77d448fb7be | 3 | public boolean canMove(Square[][] board, char c)
{
LocationSet[] legalMoves = legalMoves(board, c);
for (int x = 0; x < legalMoves.length; x++)
{
for (int y = 0; y < legalMoves[x].destinationNum(); y++)
{
if (legalMoves[x].getIndex(y) != null)
... |
090411db-0668-4fef-9ac4-6a423569f01f | 6 | public static ArrayList<Stock> QueryMultiple(ArrayList<String> codes) {
URL url;
InputStream is = null;
BufferedReader br;
String line;
Stock tmp;
ArrayList<Stock> sList = new ArrayList<>();
String urlStr = "";
for (int i = 0; i < codes.size() - 1; i++) {... |
cbed766e-3a7e-4ef0-8b35-ff4d4837bf2a | 8 | @Override
public boolean equals(Object o) {
if (o == null || !(o instanceof Book)) return false;
final Book book = (Book) o;
return Objects.equal(isbn, book.isbn) &&
Objects.equal(title, book.title) &&
authors.containsAll(book.authors) &&
book... |
92d903d8-c0e3-4427-938a-43695dbef881 | 0 | public void method() throws Exception
{
System.out.println("From ExceptionTest1 method !");
throw new Exception();
} |
2f619e0f-d166-4eca-9657-3a1e7f4260fd | 5 | public Country getCountry(int id) {
Country cnt = null;
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConn... |
1c395084-5fe3-44c6-b3ce-dac145c557cc | 7 | static int mapRejectReason(int state) {
switch (state) {
case 1:
return ACTIVE_BID_CHANGED;
case 11:
case 12:
case 13:
case 14:
return BID_NOT_IMPROVED;
case 15:
case 16:
return PRICE_NOT_BEAT;
default:
return state;
}
} |
e15cf6e0-e229-4931-906a-dbc07cdb6669 | 6 | private static void logic(long delta){
for (ListIterator<Asteroid> iterator = asteroidList.listIterator(0); iterator.hasNext();) {
Asteroid asteroid = iterator.next();
asteroid.update(delta);
if(asteroid.getHP() <= 0){
iterator.remove();
if(asteroid.getScale()>0.5f)
try {
iterator.add(new As... |
6069fe42-53d8-4f62-9b3d-4089c632ca1d | 1 | public void setFood(int food) {
if (food >= 0) {
this.food = food;
}
} |
4a1cb223-f7cb-45be-af33-aa97049bd580 | 6 | private void OpenActionPerformed(
final java.awt.event.ActionEvent evt) {
int returnVal = fileChooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
// Init TextArea to ""
jTextArea1.setText("");
jTextArea2.setText("");
// Catch the current file path
path = fileChooser.getS... |
68cfbe67-f9e6-42d3-bae1-c54cac59c44e | 1 | public boolean isLeaf() {
return left == null && right == null;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.