method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
68432feb-6a7c-45b3-b97e-2ea6c32e4034 | 8 | @Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (other == null) {
return false;
}
if (!(other instanceof Group)) {
return false;
}
Group otherGroup = (Group) other;
if (otherGroup.cards.size() != cards.size()) {
return false;
}
boolean cardsEqual =... |
f2298b9a-ec7e-4e70-ae90-2a843c5b604f | 9 | public static int assessHand(Hand hand){
Hand testHand = new Hand();
testHand.add(hand.get(0));
for(int k = 1; k < hand.size(); k++){
testHand.add(hand.get(k));
for(int i = k; i-1 >= 0 ;i--){
if (testHand.get(i).getValue() < testHand.get(i-1).getValue()){
Card card1 = testHand.get(i);... |
55f3a5e0-8cb3-4466-884a-b80a030a748d | 1 | public boolean kontroliertAfrika(Spieler s) {
boolean res = true;
if(!s.fraktion.equals(laenderGraph.getLaenderList().getLandByID(4).getOwner())) {
res = false;
}
return res;
} |
693e790e-731f-4a63-82d4-afc56547d2d1 | 0 | private CollectionCompany() {
Companies = new ArrayList<Company>();
CantCompany = 0;
} |
cbf44960-9018-4a36-b073-4c35a5eb3158 | 7 | private final static void startAlbumAnalysis(List<File> foundFiles)
throws MasterException {
int cnt= 0;
try {
Iterator<File> iter= foundFiles.iterator();
while(iter.hasNext()) {
//create the list of tasks to do.
MasterMetadata.albumTasks.add(new AlbumFeature(iter.next()));
if(++cnt =... |
aeb87bbe-9306-41d8-8a66-06a531254722 | 3 | public static int getRotatedLandscapeChunkY(int y, int objectSizeY, int rotation, int objectSizeX, int x) {
rotation &= 3;
if (rotation == 0) {
return y;
}
if (rotation == 1) {
return 7 - x - (objectSizeX - 1);
}
if (rotation == 2) {
return 7 - y - (objectSizeY - 1);
} else {
return x;
}
} |
e479f752-75f0-4a8c-b562-f32e3d96145b | 3 | private void newFilter() { //Filter the mods in Download Mods based off mod tags and search filter
String regex = "";
String comboText = "";
if(!txtFilterText.getText().equals("Filter Text")){
regex = "(?i)" + Pattern.quote(txtFilterText.getText().toLowerCase());
}
if(!comboBox.getSelectedItem().toString()... |
be46ab38-517f-4d43-be7c-0029a6e5c096 | 9 | public LoadSaveFrame(Frame paramFrame, int paramInt)
{
super(paramFrame, paramInt == 0 ? "Load..." : "Save...", true);
this.parentFrame = paramFrame;
this.mode = paramInt;
setLayout(new BorderLayout());
addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEve... |
6d83925e-4861-4839-81ce-d2eec2da3f93 | 0 | public void addCategory(Category cat)
{
this.categories.add(cat);
} |
7638e36d-6084-4e2c-a341-bd7d24ef3040 | 3 | @Override
public boolean isExistUrl(String url) {
Statement stmt;
Statement stmt2;
ResultSet rs;
ResultSet rsHistory;
try {
stmt = con.createStatement();
stmt2 = con.createStatement();
String query = "SELECT * FROM " + TABLE_NAME + " WHERE url = '"
+ url + "'";
rs = stmt.executeQuery(query... |
370196c2-cce3-4e10-b3e0-f449ae5d6e1e | 0 | public Point(int x, int y){
this.x = x;
this.y = y;
} |
0b8efad2-f1d0-460e-a536-dfc2077e2f9d | 8 | public void mouseClicked(MouseEvent mouseEvent) {
Pair<Vertex, Double> p = mindistv(g, mousePos(mouseEvent));
Vertex v = (Vertex) p.first;
if (v != null && isPointOnVertex(g, v, mousePos(mouseEvent))) {
if (mouseEvent.getClickCount() > 1)
sendEventToBlackBoard(VertexE... |
5222d6e3-cfe3-4926-ab90-b0a06e9835b3 | 0 | String getSources()
{
return sources;
} |
a0983068-d626-4dc7-8fa2-aabeb68abb64 | 1 | public String toString() {
String s = null;
s = kind.toString() + " content:" + (content== null ? "<None>" : content);
return s.toString();
} |
7132e22e-5ea8-4b2d-8384-246fe9135e9a | 8 | private void setLabelText(String text) {
switch (Integer.parseInt(text)) {
case 1:
this.label.setForeground(Color.blue);
break;
case 2:
this.label.setForeground(Color.green.darker().darker());
break;
case 3:
... |
d99c3cd0-5572-4175-87ad-753e0a7b1793 | 1 | static int standardIfElse(int i) {
if(i < 10)
return i * 100;
else
return i * 10;
} |
b862b245-ae76-473c-b1f5-7447e0b73698 | 3 | private static void writeStaticInitializer(final ClassEditor ce,
final DataOutputStream dos) throws IOException {
MethodEditor clinit = null;
final MethodInfo[] methods = ce.methods();
for (int i = 0; i < methods.length; i++) {
final MethodEditor me = new MethodEditor(ce, methods[i]);
if (me.name().equ... |
757b3083-f199-4bb4-abea-e85beed3bed6 | 2 | public boolean stand(Hero hero, Player player)
{
if (color != hero.getColor()) {
if (WorldMap.getLastInstance() != null) {
WorldMap.getLastInstance().colorChanged(this, hero.getColor());
}
}
color = hero.getColor();
return false;
} |
b24e46c4-b94e-42be-91cb-4909ac695f69 | 5 | public static void main(String[] args) {
spawnEnemy();
Frame frame = new Frame(player, bg, bullets, enemies);
frame.setSize(800, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// frame.setUndecorated(true);
frame.setVisible(true);
frame.setResizable(false);
frame.setLocationRelativeTo(... |
30be09ce-c221-4fb1-9967-569b5e4d5a1f | 5 | @Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld allowpvp <worldname> <true|false>");
} else if (!hasWorld(worldName)) {
reply("World not found: " + worldName);
}... |
cbf6f6b4-2d27-4377-a60b-d16b87db204c | 5 | @Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
if (Util.isDigit(event))
{
htmltext = null;
int npcId = Integer.parseInt(event);
if (Util.contains(NPCRADA... |
762acd63-1efd-4e6a-9bce-908650e9fd2b | 5 | public void move() {
//create a new location for the head, using the direction.
int x = 0;
int y = 0;
switch (getDirection()) {
case UP:
x = 0;
y = -1;
break;
case DOWN:
x = 0;
y = 1;
... |
9031a1fc-128d-4697-8d85-efb3dd7ee042 | 9 | public Expr bp_smt(Context ctx, a_expression bp, ArrayList<arrayModification> am, ArrayList<parameter> functionInputs) throws Z3Exception{
// bp is the a_expression
// am is a list of array modification
// functionInputs is declared const
HashMap<String,Expr> symbolTable = new HashMap<String, Expr>();
parame... |
66e153f8-f9a5-42b0-b359-4130d70e505d | 2 | public User getByName(String name) {
for (int i = 0; i < userList.size(); i++) {
if (name.equals(userList.get(i).getName()))
return userList.get(i);
}
return new User();
} |
f353e111-f903-4dd2-98da-02033f42ff4a | 8 | public Integer call() {
Integer result = 0;
Connection connection = DbPool.connection(server, dbName);
if (connection == null) {
onVerbose("Can not obtain connection to %s.%s", server.getId(), dbName);
} else {
onVerbose("Obtain connection to %s.%s", server.getId(), dbName);
}
if (d... |
311b4069-ef31-46c7-971b-7cbc9a9a4d47 | 7 | public boolean fToggle(String mode)
{
//get element
WebElement objToggle = objCommon.getObject(btnToggle);
if(objToggle==null) return false;
String expectedState;
if(mode.trim().equalsIgnoreCase("play")) expectedState = "true";
else if(mode.trim().equalsIgnoreCase("pause")) expectedState = "false";
el... |
5edb6aef-8051-4d47-b405-a02ad639f079 | 3 | @Override
public boolean match(PathInput input) {
if (input.end()) {
return isOptional();
} else {
String item = input.value();
try {
long n = Long.parseLong(item);
input.next();
if (input.isBind()) {
... |
130725e4-1a82-4aca-9e25-be02cc171971 | 8 | @BeforeClass
public static void setUpBeforeClass() throws Exception {
defaultPhone = new IOSPhone();
phoneDescription = new HashMap<String, Object>();
phoneDescription.put("name", "3Gs");
phoneDescription.put("brandName", "Apple");
phoneDescription.put("screenSize", 5);
phoneDescription.put("screenType",... |
2c71f909-d759-476c-b7a6-a8c7fa3bb1b1 | 5 | private void partnerFollow(){
if(player.getPartner()!=null){
if(player.getPartner().getName() != null)
if(getMob(player.getPartner().getName())!=null){
setStateType(InputState.LISTEN);
if (player.stopPartnerDisabled)
triggerScript("toggleFollowDisabled");
else if(player.getPartner().getSta... |
d5badc6c-9795-47b7-8193-ae4d6a118548 | 1 | public boolean setShutdownButtonHeight(int height) {
boolean ret = true;
if (height < 0) {
this.buttonShutdown_Height = UISizeInits.SHD_BTN.getHeight();
ret = false;
} else {
this.buttonShutdown_Height = height;
}
somethingChanged();
... |
3fc11beb-4c80-4d74-bc31-c89324562d4b | 3 | @Override
public GameState doAction(GameState state, Card card, int time) {
if(time == Time.DAY)
{
state = VoodooDay(state, card, true);
}
else if(time == Time.DUSK)
{
PickTreasure temp = new PickTreasure();
state = temp.doAction(state, card, time);
}
else if(time == Time.NIGHT)
{
//Do n... |
fdaec073-da56-4ed8-b994-8cf19617d445 | 3 | public int getUniformLocation(String name) {
int location = -1;
Integer locI = uniforms.get(name);
if (locI == null) { // maybe it's not yet cached?
location = GL20.glGetUniformLocation(program, name);
uniforms.put(name, location);
} else
location = lo... |
25c1f112-cadb-44f2-9502-f483be80dee8 | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
int times = Integer.parseInt(in.readLine().trim());
for (int i = 0; i < times; i++) {
if (i != 0)
out.append("\n");
in.readLine... |
2bf1c82a-9798-461b-a274-1e038f199707 | 5 | public ResultModel(Document doc) {
Element rootElement = doc.getRootElement();
fanyiElement = rootElement;
errorCodeElement = fanyiElement.getChild("errorCode");
//errorCode
errorCode = errorCodeElement.getValue();
basicElement = fanyiElement.getChild("basic");
if(basicElement != null){
phoneticElement... |
dcf25d04-1377-4955-97b8-dd8b0150e404 | 9 | private void method37(int j)
{
if(!lowMem)
{
if(Texture.anIntArray1480[17] >= j)
{
Background background = Texture.aBackgroundArray1474s[17];
int k = background.anInt1452 * background.anInt1453 - 1;
int j1 = background.anInt1452 * anInt945 * 2;
byte abyte0[] = background.aByteArray1450;
b... |
076c614c-c470-4520-8a78-77d68daf0822 | 9 | private void digHole() {
char ch;
int i, j, k, m;
for (i = 0; i < 81; i++)
hasTryed[i] = false;
boolean flag;
for (i = 0; i < 81; i++) {
do
m = MWC.random() >> 8 & 127;
while (m >= 81 || hasTryed[m]);
hasTryed[m] = true;
ch = data[m];
flag = false;
for (j = 0; j < 9; j++)
if (ch !... |
e4dc330a-5c61-4a25-b08f-e4b0d000b6c2 | 0 | public int getSize() {
return laenderMap.size();
} |
bd157902-6e81-49ff-99a2-05967f537e29 | 9 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (args.length == 0) {
if (player == null) {
sender.sendMessage(ChatColor.RED+"This command can o... |
6cdce94d-4613-4cef-afae-75a2bb3ffa56 | 0 | protected DatagramSocket getSocket() {
return socket;
} |
6a1a27f6-54c3-4275-971c-9faa95554971 | 7 | private final boolean cons(int i) {
switch (b[i]) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
return false;
case 'y':
return (i == 0) ? true : !cons(i - 1);
default:
return true;
}
} |
ed9b06c7-1ffe-4250-873f-89e3e5672cfa | 5 | @Override
public boolean equals(Object m) {
if (m == this) {
return true;
}
if (m == null || m.getClass() != this.getClass()) {
return false;
}
Position p = (Position) m;
if (p.file == this.file &&
p.rank == this.rank) {
return true;
}
return false;
} |
3a833c2d-4da4-418b-bba0-cf8a0a286a84 | 9 | private void factor() {
int n = LU.numRows();
double[] LUi = new double[n];
// Find the indices to the diagonal entries
for (int k = 0; k < n; ++k) {
SparseVector row = LU.getRow(k);
diagind[k] = findDiagonalIndex(row, k);
if (diagind[k] < 0)
... |
2e014904-d840-489f-9f9a-913e597bec25 | 3 | public String next() {
try {
String result = nextline;
// If we haven't reached EOF yet
if (nextline != null) {
nextline = in.readLine(); // Read another line
if (nextline == null)
in.close(); // And close on EOF
}
// Return the line we read last time through.
return result;... |
9c8a1321-89b7-41ab-bb68-657ecfe0d154 | 7 | private RBNode delete(RBNode n) {
if (n == null)
return null; // Key not found, do nothing
if (n.left != null && n.right != null) {
// Copy key/value from predecessor and then delete it instead
RBNode pred = maximumNode(n.left);
n.CopyContent(pred);
... |
412f4f03-de8c-40b1-ad0f-ae3b18b0f135 | 6 | @Override
public MapleData getChildByPath(String path) {
String segments[] = path.split("/");
if (segments[0].equals("..")) {
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
}
Node myNode = node;
for (int x = 0; x < segments.length; x++) {
NodeList childNodes ... |
40dc718e-252a-4af4-ab9a-2bf56404e31e | 9 | public int readByte()
throws IOException
{
if (_chunkLength > 0) {
_chunkLength--;
if (_chunkLength == 0 && _isLastChunk)
_chunkLength = END_OF_DATA;
return read();
}
else if (_chunkLength == END_OF_DATA) {
_chunkLength = 0;
return -1;
}
int tag = re... |
0d216bc1-982f-455d-a715-b6e1dd69842f | 1 | public String readLine() {
String line;
try { line = Encryptor.decrypt(scanner.nextLine(),5); }
catch (Exception e) { line = null; }
return line;
} |
5997d705-02d5-4312-8c43-2792c4f2a686 | 5 | public static void main(String[] args) {
if(args.length > 0) {
for(int i = 0; i < args.length; i++) {
if(args[i].equals("-port"))
port = args[i + 1];
}
}
else {
port = "";
}
if(port.isEmpty())
port = defaultPort;
try {
simDlo = new SimulatorD... |
411bbf48-6cec-44e0-9544-ae742822d879 | 6 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int times = 1;
while ((line = in.readLine()) != null && line.length() != 0) {
int size = Integer.parseInt(line) * ... |
10837bf2-5e48-4956-b4b3-bc5b96f1663b | 1 | public static void validateUser(User currUser) throws TechnicalException {
if (currUser == null) {
throw new TechnicalException(MSG_ERR_NULL_ENTITY);
}
validatePhone(currUser.getPhone());
validateEmail(currUser.getEmail());
} |
4e272c31-3d30-4ffb-bace-e184298d0ce4 | 9 | private void gameLoop() {
long lastTime = System.nanoTime();
long timer = System.currentTimeMillis();
final double ns = 1000000000.0 / 60.0;
double delta = 0;
int frames = 0;
int updates = 0;
gameMap = new Map();
while (gameRunning) {
long now = System.nanoTime();
delta += (now - lastTime) /... |
3007dce2-e35f-4a74-9bee-a18ff2f45333 | 9 | public boolean remove (AbstractRule R)
{
HashMap<Object, HashMap<Object, LinkedList <AbstractRule>>> rc = get(R.getAction().getID());
if (rc == null)
return false;
boolean success = false;
for(Dimension d : R.getCondition().values())
{
HashMap<Object, LinkedList <AbstractRule>> rrc = rc.get(d.getID());... |
db57306a-4cc0-468a-a632-5066e5b51975 | 3 | public String decrypt(String cipherTextBase64Str) {
final Cipher cipher;
final SecretKeySpec SKSAESKey;
final int blockSize;
final byte[] ivBytes;
final byte[] ivWithCipherTextBytes;
final IvParameterSpec iv;
final byte[] cipherTextBytes;
final String plai... |
3a1b2db3-e82c-4ac8-a3a6-28c02fabcf08 | 6 | private void readMain(XMLStreamReader xmlsr) throws XMLStreamException {
// Type d'évenement
int eventType;
// Boucle de lecture du xml
while (xmlsr.hasNext()) {
eventType = xmlsr.next();
// Début d'élément
if (eventType == XMLEvent.START_ELEMENT) {
// Choix de la méthode à effectuer selo... |
a02e7112-1a78-4193-9aa2-0eeb565c35a6 | 5 | @WebMethod
private String getJSonOutput(String urlString) {
String jsonOut = "";
try {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "app... |
ab954a42-6809-407b-b60d-66f9b8a53d2c | 5 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
int h = PLOT_FRAME_HEIGHT - 25;
int w = PLOT_FRAME_WIDTH;
// Draw plot axes
g.drawLine(0, h/2, w, h/2); // x
g.drawLine(w/2, 0, w/2, h); // y
double max_d = ... |
ec4f7900-411a-4714-8fe5-5ca6569e9cf9 | 1 | public Card(JPanel parent, Map<String, String> user)
{
username = user.get("username");
setLayout(new GridLayout(1,2));
String path = "suit.jpg";
URL imgURL = Main.class.getResource(path);
ImageIcon icon = new ImageIcon(imgURL);
JLabel l=new JLabel();
l.setIcon(icon);
add(l);
add(new JLabel(us... |
049a4720-b37d-4ec3-8195-5f971dfc2bd7 | 8 | public boolean giveArmour(Team team) {
ItemStack helmet = Utils.setColour(new ItemStack(Material.LEATHER_BOOTS), team == Team.BLUE ? 0 : 255, 0, team == Team.BLUE ? 255 : 0);
ItemStack chestplate = Utils.setColour(new ItemStack(Material.LEATHER_BOOTS), team == Team.BLUE ? 0 : 255, 0, team == Team.BLUE ? 255 : 0);
... |
370529ce-8d2d-4867-904f-8f7d2fe09891 | 7 | public boolean isInInventory(String serialNumber, MainFrameXLS frame){
String status = "";
loadSheets();
//Check if number is ICCID of a card
if(serialNumber.length() >= 6 && serialNumber.substring(0, 6).equalsIgnoreCase("089351"))
serialNumber = serialNumber.substring(2);
for (int i = 0; i < serialNumb... |
639bed51-1f26-4f34-b955-77ae8e6b8949 | 2 | @Override
public boolean onKeyDown(int key) {
Iterator<IScreenItem> it = screenItems.iterator();
while(it.hasNext()) {
IScreenItem item = it.next();
if(item.onKeyDown(key)) {
return true;
}
}
return false;
} |
591611aa-1f29-4642-ab81-30b6c852fa04 | 3 | public void visit_invokespecial(final Instruction inst) {
CallVisitor.db("\n Visiting call: " + inst);
// Recall that invokespecial is used to call constructors, private
// methods, and "super" methods. There is no dynamic dispatch for
// special methods.
final MemberRef callee = (MemberRef) inst.operand(... |
57f6b5be-85c0-4fae-98ec-44c3b09aaa61 | 2 | public void testGetField() {
YearMonthDay test = new YearMonthDay(COPTIC_PARIS);
assertSame(COPTIC_UTC.year(), test.getField(0));
assertSame(COPTIC_UTC.monthOfYear(), test.getField(1));
assertSame(COPTIC_UTC.dayOfMonth(), test.getField(2));
try {
test.getField(-1);
... |
f25851b9-816d-49c2-bb7c-f31b099ddb40 | 4 | public String texteDescription(){
String texte="\t\t\tFeuille de route\r\n";
if(this.testTourneeCalculee()){
String texteTmp = "";
texte+="D�part de l'entrepot: ";
texte+=GestionCalendar.calendarToHeureString(this.entrepot.getHeure());
texte+="\r\n";
texte+=entrepot.getTrajet().texteDescription();
... |
aebc6295-3cae-4b17-8459-84b73a69b0e9 | 1 | @Override
public boolean accept(File file) {
return file.isDirectory() || file.getName().endsWith(".crl");
} |
a8cf23d1-ad96-4fe7-b8d6-4fec9ae408af | 3 | private Expression first( List<Expression> args, String caller ) {
if ( args.size() != 1 ) {
System.err.println("first/head expected exactly one argument and got " + args.size() );
return new Void();
}
Expression expr = args.get(0).eval(defSubst, caller);
i... |
83158af8-18b5-4215-bcc9-57b596209e2d | 4 | @SuppressWarnings("unchecked")
public Provider updateProvider(String token, HashMap<String, Object> provider){
if(provider.containsKey("contact")) this.setContact((String)provider.get("contact"));
if(provider.containsKey("name")) this.setName((String)provider.get("name"));
if(provider.containsKey("picture"... |
17dd470c-3841-41e9-b81e-e4b4a7a59718 | 7 | public Message getMessageClass(String msg) {
String msgType = msg.substring(2, 4);
String classStr = MSG_CLASSES.get(msgType);
Message message = null;
try {
Class<Message> claz = (Class<Message>) Class.forName(classStr);
Constructor constructor = claz.getConstructor(String.class,
String.class);
... |
59a6be37-ce4a-465c-b6e3-502cbc4b125c | 9 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (compression ? 1231 : 1237);
result = prime * result + Arrays.hashCode(data);
result = prime * result + dataLength;
result = prime * result + (dataLengthIndicator ? 1231 : 1237);
result = prime * result + (e... |
de71416a-7a52-4f31-bda7-7a3d749677f1 | 2 | private void initPlayer(int playerNum) {
int x = (int) (Math.random()*(width-1));
int y = (int) (Math.random()*(height-1));
Player player = new Player(x, y, grid[x][y]);
if (!(grid[player.getX()][player.getY()] instanceof Fence) && !(grid[player.getX()][player.getY()].contains(Mho.class)))
grid[player.getX(... |
397c3169-8c71-4a5e-b29f-b270f8bffcb6 | 0 | @Override
public IReceiveMessage getReceiveMessage() {
return receiveMessage;
} |
79c6dbb6-c077-4f53-a534-f8654a9c6a0f | 7 | private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened
jLabel4.setText(this.getTitle());
jLabel4.setVisible(false);
ChamadoDAO dao = new ChamadoDAO();
ArrayList resultadoChamados = dao.pequisar();
... |
b6795536-b0d9-4d25-bc69-d469dbf85dfb | 9 | public static void main(String[] args) throws InterruptedException{
int iloscProcesow1 = 5;
int iloscProcesow2 = 8;
int iloscProcesow3 = 4;
Thread procesy1[] = new Thread[iloscProcesow1];
Thread procesy2[] = new Thread[iloscProcesow2];
Thread procesy3[] = new Thread[iloscProcesow3];
Zasoby zaso... |
0a0a8536-ff40-48f0-9379-743fa61f239f | 4 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Vector)) return false;
Vector point = (Vector) o;
if (x != point.x) return false;
if (y != point.y) return false;
return true;
} |
d02635dc-808c-4326-a3b8-ffc80ebd9aff | 7 | 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.");
... |
6cb7c861-c731-4726-a886-8b6b9619c855 | 0 | @Basic
@Column(name = "active")
public int getActive() {
return active;
} |
416da329-2d9e-46cd-87b9-f0372994811c | 0 | protected AnnotatedHandlerBuilder<Constructor> handleConstructor()
{
return wrapped.handleConstructor();
} |
280a9f3e-3d00-4f03-8d17-7bb48510a6d9 | 1 | @Test
public void getTest() {
for (int i = 0; i < TESTS; i++) {
double x = rand.nextInt();
double y = rand.nextInt();
Point p = new Point(x, y);
assertEquals(x, p.getX(), PRECISION);
assertEquals(y, p.getY(), PRECISION);
}
} |
389b56ba-3bfe-4a49-9b0a-2678a2fb2ca0 | 0 | public void setRoot(final Node<K> root) {
this.root = root;
} |
7d5fe3b1-869f-44d0-bbbd-f93530e06072 | 0 | private boolean isSameDisk(long binPosition){
boolean isGivenPositionBlack = ( (this.binIsBlack & binPosition) != 0 );
return !(isGivenPositionBlack ^ isBattingFirstTurn);
} |
e6f67909-a628-4bf0-b461-2ae705c97f4c | 3 | public String readToken() throws Throwable
{
File file = new File("token.txt");
if (file.exists())
{
String t = Files.readAllLines(file.toPath(), Charsets.ISO_8859_1).get(0);
if (t.matches("^[a-zA-Z0-9]{16}$") && t.length() == 16)
{
return t;
}
}
return null;
} |
adacdb7d-9625-4cbe-9943-42a3a41ab028 | 1 | @Override
public void onEnable(){
log = getLogger();
initialConfigCheck();
currencyManager = new Currency(this);
if(!currencyManager.allowEnable()){
logError("The currency manager has blocked RealStore from enabling. Check the config settings for accuracy!");
onDisable();
return;
}
loadCoffers(... |
c2ae046e-6ea4-4659-a6a6-f5b1952f1e7c | 6 | @Override
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source == addLocation) {
addLocation();
} else if (source == removeLocation) {
removeLocation();
} else if (source instanceof Location) {
Location location = (Location) source;
if (e.getActionCommand().equals(... |
ef7ba37a-0648-4c6b-9ca6-53203743aa1d | 8 | public static boolean isPrime(long n) {
if (n < 2)
return false;
if (n == 2 || n == 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
long sqrtN = (long) Math.sqrt(n) + 1;
for (long i = 6L; i <= sqrtN; i += 6) {
if (n ... |
83c5f7f6-d3be-4378-8d4c-ecbf1699d4c6 | 3 | @Override
public List<Direction> findDirections(Criteria criteria) throws DaoException {
Short status = (Short) criteria.getParam(DAO_DIRECTION_STATUS);
Boolean allStatus = (Boolean) criteria.getParam(DAO_DIRECTION_ALLSTATUS);
if (allStatus != null && allStatus) {
criteria.remuve... |
5e298f6f-c38b-4b0f-9c44-fde1c157b608 | 1 | public OutputStream getOutputStream() throws java.io.IOException{
if (outputStream == null){
setOutputStream(socket.getOutputStream());
}
return outputStream;
} |
d8b26f76-7c73-421a-85ab-364bdad2b093 | 0 | @Override
public void setCur(String value) {
this.cur = convertToHashMap(value);
} |
dbfdd46b-2554-45f0-8aab-1f8c689ae812 | 3 | private void compile(File compile) {
ProcessBuilder grammarBuilder = new ProcessBuilder("/bin/tcsh", "compile");
grammarBuilder.directory(compile);
try {
Process phoenix =grammarBuilder.start();
BufferedReader stderr2 = new BufferedReader(new InputStreamReader(phoenix.getErrorStream()));
String phoeni... |
2d4dd0ae-eebb-4a51-9bf5-a491fc2f5224 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
InterestsEntity that = (InterestsEntity) o;
if (interestId != that.interestId) return false;
if (interestName != null ? !interestName.equals(th... |
8321c25a-b1a2-475a-9e34-3addaa8eccc3 | 8 | void simulate(ArrayList<Process> l)
{
int[] waitTime = new int[l.size()-1];
int[] turnAroundTime = new int[l.size()-1];
int timer = l.get(0).arrivalTime;
boolean flag = true;
for (int i = 0; i < l.size()-1; i++)
{
Process p = l.get(i);
char nam... |
0a6d3c04-a79a-4151-8eae-6cdbb6cc3083 | 7 | public boolean fireballCollideCheck(Fireball fireball)
{
if (deadTime != 0) return false;
float xD = fireball.x - x;
float yD = fireball.y - y;
if (xD > -16 && xD < 16)
{
if (yD > -height && yD < fireball.height)
{
if (facing!=0) retu... |
cd3bc879-88e8-47cf-9814-f707f840e385 | 7 | @Test
public void testFromString() {
String s = "basic";
try {
Rarity r = Rarity.fromString(s);
assert(r == Rarity.BASIC);
} catch (IOException io) {
fail(io.getMessage());
}
s = "fine";
try {
Rarity r = Rarity.fromString(s);
assert(r == Rarity.FINE);
} catch (IOException io) {
fail(io.... |
fa7a5849-ab50-455e-9953-057ed8bb9b50 | 7 | private void doEventLoop()
{
int currentStackLength = windowStack.size();
if(currentStackLength == 0)
return;
while(true) {
if(currentStackLength > windowStack.size()) {
//The window was removed from the stack ( = it was closed)
break;... |
7cea3c64-2d6c-4c7d-8369-672bc2ef4b4e | 3 | public byte[] readNextFile() throws IOException {
if(this.lastHeader == null) {
throw new RuntimeException("Must first read a new header");
}
int fileSize = this.lastHeader.getFileSize();
// Read a complete File entry
byte[] fileContent = new byte[fileSize];
... |
37139ef9-0fc9-4fa3-b1c7-d3902ca512a5 | 4 | public static double[][] multiply(double[][] A, double[][] B){
if(A[0].length != B.length)
return null;
double[][] T = new double[A.length][B[0].length];
int t = 0;
for(int i = 0; i < A.length; i++){
for(int j = 0; j < B[0].length; j++){
for(int k = 0; k<A[0].length; k++){
t+= A[i][k]*B[k][j];
... |
15e86c13-3516-4285-89aa-e874614a1544 | 8 | static FormattingTuple arrayFormat(final String messagePattern,
final Object[] argArray) {
Throwable throwableCandidate = getThrowableCandidate(argArray);
if (messagePattern == null) {
return new FormattingTuple(null, argArray, throwableCandidate);
}
if (argArray == null) {
return new FormattingTupl... |
1aa49c63-0552-44ea-9757-5f8fc1366c80 | 6 | @Override
public void onPrivateMessage(PrivateMessageEvent e) {
final String command = RUtils.getFirstWord(e.getMessage());
if (!command.equalsIgnoreCase("authenticate")) return;
final User u = e.getUser();
if (!PermissionHandler.atLeastMod(u.getNick())) {
e.respond("You ... |
85da5a46-ccbc-47da-aaf3-2923059985ea | 8 | public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(br.readLine());
String s = br.readLine();
int n = s.length();
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(... |
9b3ecdcc-c666-4df8-adcc-c39d8837094d | 3 | public static boolean isInteger(String cmdLineArg) {
if(cmdLineArg == null || cmdLineArg.isEmpty()) {
return false;
}
boolean result;
try {
Integer.parseInt(cmdLineArg);
result = true;
} catch(NumberFormatException e) {
res... |
29907864-2b75-4a38-ba73-0a1a8d52aa63 | 2 | @Override
public void setPredictions(String[] predictions) throws NGramException {
/*
* if ((predictions == null) || ((predictions != null) &&
* (predictions.length == 0))) { throw new NGramException("ERROR:"); }
* if (predictions.length > 0) { for (String s : predictions) { if ((s
* == null) || (s.isEm... |
d4c7c07b-0389-425a-aa32-1e2c89a16279 | 3 | public Boolean isEmptyTable(JTable table) {
for (int i = 0; i < table.getRowCount(); i++) {
for (int j = 1; j < table.getColumnCount(); j++) {
if (table.getValueAt(i, j) == null) {
return true;
}
}
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.