method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
15ad9640-3ecd-4141-aa0e-14ac872021d2 | 5 | private static void startContest() {
String name = contestName;
log("Loading \"" + name + "\" contest configurations..\n");
Server_Loader.contestFolder = new File("contests/" + name);
log("Contest directory: " + Server_Loader.contestFolder.getAbsolutePath().toString() + "\n");
tr... |
ad8f37d4-c1cd-463f-a72c-d999d72be793 | 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... |
d81daeab-58d5-4e33-8a83-be66491dd96f | 8 | @Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != this.getClass()) {
return false;
}
if (this == obj) {
return true;
}
State state2 = (State) obj;
if (this.isFinal ^ state2.isFinal()
|| this.ge... |
b5fee19d-cc1e-44ac-8fc8-35b605894c5c | 6 | public void handleResize() {
winSize = cv.getCanvasSize();
if (winSize.width == 0) {
return;
}
dbimage = new BufferedImage(winSize.width, winSize.height, BufferedImage.TYPE_4BYTE_ABGR);
int h = winSize.height / 5;
/*if (h < 128 && winSize.height > 300)
... |
dd6a6513-ba70-477a-911a-98135e14fcbc | 6 | public void action(String stringRecup) {
if (stringRecup.equals("")) {
practice.addWrong(iterateur - 1);
} else {
switch (e.getType()) {
case "calculation":
actionIfCalculation(stringRecup);
break;
case "frac... |
b24d6a5a-5f88-48a1-9d24-86e8f0c098fa | 4 | private void setMobs() {
switch (lvl) {
case 1:
mobsStack = new ArrayList<GenericMinion>();
for (int i = 0; i < 30; i++)
mobsStack.add(new Minion1Ground(new Vector2d(50, 50)));
break;
case 2:
mobsStack = new ArrayList<GenericMinion>();
for (int i = 0; i < 30; i++)
mobsStack.add(new Minion1G... |
e2474b95-2c05-45d3-b659-b03945490085 | 8 | private static String htmlFilter(String message){
if(message == null) return null;
int len = message.length();
StringBuffer result = new StringBuffer(len + 20);
char aChar;
for(int i =0; i< len; i++){
aChar = message.charAt(i);
switch (aChar) {
case '<': result.append("<"); break;
... |
649877d2-f9e0-4e00-a990-8d443157fa74 | 2 | public void login(HttpServletRequest httpRequest, HttpServletResponse httpResponse) {
log.info("Starting DrupalAuth authentication");
HttpSession session = httpRequest.getSession();
session.setAttribute("drupalauth.authCookieName", authCookieName);
session.setAttribute("drupalauth.authValidation... |
642bf942-50a6-4f55-a0b2-a6dac1d31a1e | 6 | private static void sortByX(ArrayList<Point> xArray) {
Collections.sort(xArray, new Comparator<Point>() {
@Override
public int compare(Point p1, Point p2) {
if (p1.getX() > p2.getX()) {
return 1;
} else if (p1.getX() < p2.getX()) {
... |
35745758-c226-42dc-ad88-ca171944a2c8 | 8 | protected void init() {
this.setTitle(descriptor.getWindowTitle());
//add default action listeners for this descriptor if there aren't any yet
if(descriptor.getActionListeners().isEmpty()) {
defaultActionListener = new ConfirmDialogActionListener();
descriptor.add... |
49e7413b-4a3d-4e1c-b19a-1e87fe86d8a5 | 4 | public void doGet( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException
{
String arkID;
arkID = null;
try
{
arkID = request.getParameter( "ark" );
}
catch ( Exception e )
{
e.printStackTrace();
}
if ( ... |
9f18f7ec-7d39-4d12-8860-8b98c7dd6295 | 5 | public String getTranscriptId() {
// Try transcript ID
String trId = get("transcript_id");
if (trId != null) return trId;
// Try 'protein'...
trId = get("protein_id");
if (trId != null) return trId;
// Try 'locus'...
trId = get("locus_tag");
if (trId != null) return trId;
// Try 'db_xref'...
tr... |
e4137cc9-d34a-468b-8631-2c8ffca57c1f | 8 | public boolean isDominatorSet(VarVersionNode node, HashSet<VarVersionNode> domnodes) {
if (domnodes.size() == 1) {
return engine.isDominator(node, domnodes.iterator().next());
}
else {
HashSet<VarVersionNode> marked = new HashSet<>();
if (domnodes.contains(node)) {
return true;
... |
949f849a-2883-4a96-9fe9-bbc04518e192 | 6 | private void closeThisWindow() {
final String[] options = new String[]{"Save", "Discard", "Cancel"};
int ret = JOptionPane.showOptionDialog(theFrame,
"You have unsaved changes", "Warning", 0, 0, null,
options, options[0]);
switch(ret) {
case -1: case 2: // -1 is cancel, +2 is Cancel
return;
case 0:... |
62c7f5b5-0d1c-4365-86ba-6c207f010086 | 8 | public void preAssignedCoupon() {
String querySELECTMSISDN = "select coupon_id from definingpreassigned_coupons";
String querySELECTSISDN1 = "select deviceid,dreg_date from device order by dreg_date";
log.info(querySELECTMSISDN);
log.info(querySELECTSISDN1);
try {
... |
7c65a178-fff1-4e6a-b775-7f700d3af117 | 2 | @SuppressWarnings("unused")
private ParkingPlace getItem() {
ParkingPlace place = null;
LOCK.lock();
try {
for (int i = 0; i < SIZE; i++) {
place = PLACES.get(i);
if (!place.isUsed()) {
place.togleUsed();
}
return place;
}
} finally {
LOCK.unlock();
}
return place;
} |
03e282f1-959b-479c-80d9-9ce288a64658 | 2 | public boolean pollout (int index) {
if (index < 0 || index >= this.next)
return false;
return items [index].isWritable ();
} |
f6b5df7b-110e-441b-8451-48cf142e163c | 2 | private void resize(int capacity) {
LinearProbingHashST<Key, Value> temp = new LinearProbingHashST<Key, Value>(capacity);
for (int i = 0; i < M; i++) {
if (keys[i] != null) {
temp.put(keys[i], vals[i]);
}
}
keys = temp.keys;
vals = temp.val... |
115774a2-931c-4f83-abf6-c74f7a19c4bc | 7 | @Test
public void test() {
for(int k = 1; k < n; k++){
expValues.add(Integer.valueOf(k));
}
Map<Integer, List<Double>> messwerteNormal = new HashMap<>();
Map<Integer, List<Double>> messwerteFast = new HashMap<>();
GeneratorModule gm = new GeneratorModule(n, n, 0.01); // p = 0.01
gm.generateRandomMa... |
310433be-6d7c-40d3-9769-7e82330dfa50 | 3 | public void step(Graphics2D graphics) {
drawTitle(graphics);
graphics.setColor(Color.WHITE);
for (Star star : stars) {
star.update();
star.draw(graphics);
}
for (Button button : buttons)
button.draw(graphics);
for (HoverBox hoverbox : h... |
722a9984-66c9-4ccf-a0c6-acadae400909 | 3 | @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
Object result = null;
// Clear the results from the previous invocation.
results.clear();
// For each listener currently in this notifier...
for (T listener : this)
{
// Catch errors thrown by listeners
t... |
6cbb0f70-3783-4251-9254-a22b8fa0f32e | 1 | public List<Integer> inorderTraversal(TreeNode root){
List<Integer> list = new ArrayList<Integer>();
if(root == null)
return list;
inorderRec(list,root);
return list;
} |
7ca2bc54-abb5-47cc-bea5-3d4880013ec8 | 2 | public ArrayList<Bid> getBids() {
ArrayList<Bid> history = new ArrayList<>(20);
for (Bid b : bids) {
if (b.bid > 0) history.add(b);
}
return history;
} |
eb485edb-7743-4b9b-bcfb-e8d10ed3fba1 | 2 | public boolean equals(Object other)
{
if (!(other instanceof Location))
return false;
Location otherLoc = (Location) other;
return getRow() == otherLoc.getRow() && getCol() == otherLoc.getCol();
} |
78d19190-90ff-4e78-ad12-71dfd26ebe7f | 1 | @Override
public void move(Direction direction) {
while (getGrid().canMoveElement(this, direction)) {
getGrid().moveElement(this, direction);
decrementLifetime();
}
} |
3605a2e6-a2b2-4110-8e79-9e9a35d572fc | 0 | public Grid() {
start();
} |
a4ced61c-8c60-4e45-b149-aa11c0504902 | 8 | private boolean isDropPlaneIntersected(char direction, int index) {
if (index < 0 || index >= modelManager.frame.atomCount)
return false;
Atom at = modelManager.frame.atoms[index];
Point3f center = dropPlane.getCenter();
float radius = at.getVanderwaalsRadiusFloat();
switch (direction) {
case 'x':
if ... |
8cfdea97-9aa9-4969-8ae1-4a1288933ac1 | 3 | public void mouseDragged(MouseEvent arg0) {
//super.mouseDragged(arg0);
System.out.println(arg0.getPoint());
if (pressed) {
if (superInstance.getDisplayedToolIndex() == 1) {
superInstance.setStartPoint(arg0.getPoint());
cover.setStartPoint(arg0.getPoint());
// superInstance.updateDisplay();
} els... |
788b779f-64c0-4f1c-b280-ac5f60bc5884 | 0 | public void setTable(List<TableColumnDesc> table) {
this.table = table;
} |
162c73ac-4468-4b75-92e3-73e8863f4aca | 6 | private void antTurn() {
// Queen Ants takes her turn first
QueenTurn.takeTurn(turn);
ListIterator<Ant> itr = activeAnts.listIterator(0);
// Iterates through the activeAnts Linked List letting each ant in the list take a turn
while (itr.hasNext()) {
ant = (Ant) itr.next();
if (ant.isAlive() =... |
3f1d65d6-6f6c-49e1-8483-59d8a8280add | 1 | public void testConstructor_ObjectStringEx4() throws Throwable {
try {
new LocalDate("T10:20:30.040");
fail();
} catch (IllegalArgumentException ex) {}
} |
46618257-bdbc-4938-a3b8-5e86d2ddc131 | 6 | public static void main (String[] args) {
// Parse args
if (args.length < 3) {
System.out.println("Usage \"droid-arena-java BOT_CLASS_NAME CSRF_USER CSRF_TOKEN\"");
return;
}
CSRF_USER = args[1];
CSRF_TOKEN = args[2];
// Init bot
String b... |
7903eb91-90d2-4a1a-a4ee-9920a1c5dab3 | 7 | public static void setPrograms() {
getPrograms().clear();
try {
String line, name = "";
String[] str = null;
Process p = Runtime.getRuntime().exec(System.getenv("windir") +"\\system32\\"+"tasklist.exe /v /fo csv");
BufferedReader input = new BufferedReader(new InputStreamReader... |
db53ef1a-9ad4-45bc-8732-97c9a366914a | 5 | public void render(Graphics g)
{
switch(state)
{
case INTRO:
try
{
g.setColor(Color.GREEN);
g.fillRect(0, 0, getWidth(), getHeight());
int width = 400, height = 200;
g.drawImag... |
ba79a217-c416-4f02-8b1f-a83a98584554 | 0 | public void sendToTimeToSolve(long timeInSec) {
OSCMessage message1 = new OSCMessage("/ch/timetosolve");
message1.addArgument((float)timeInSec);
send(message1);
} |
9bfa376f-0b23-4f0a-99fd-41454726c284 | 9 | public CheckResultMessage checkSum3(int i, int j) {
int r1 = get(10, 2);
int c1 = get(11, 2);
int tr1 = get(20, 5);
int tc1 = get(21, 5);
BigDecimal sum = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
for (File f : Main1.files1) {
try {
in = new FileInputStream(f);
hWorkbook =... |
f8979bd8-be4a-4632-adb6-1c284a647864 | 2 | public void redoLastMove() {
if (!this.redoList.empty()) {
Move lastMove = this.redoList.pop();
// this.executeMove(lastMove); // Will clear the redo list !!!OBS!!!
lastMove.execute();
Player oppositePlayer = this.getOppositePlayer(lastMove.player);
this.setTurn(oppositePlayer); // Change turn to opposi... |
490335d2-fa76-4d68-b4fe-903501c959a9 | 6 | private void parseQuantifier(Node node) {
if (offset < input.length()) {
char c = input.charAt(offset);
if (c == '{') {
offset++;
int end = input.indexOf('}', offset);
String[] temp = input.substring(offset, end).split(",");
if (temp.length == 2) {
node.setBounds(Integer.parseInt(temp[... |
ebacc623-5946-431f-a22b-36209414a5b2 | 2 | public static ArrayList<Question> getQuestionsByQuizID(int quizID) {
ArrayList<Question> questionList = new ArrayList<Question>();
try {
String statement = new String("SELECT * FROM " + DBTable + " WHERE quizid = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, qui... |
e63adec5-15b3-458c-a0e8-cbed97efcd42 | 1 | public void endDocument() throws IOException {
// End all open elements.
while (!openElements.isEmpty()) {
endElement();
}
w.flush(); //writers do not always flush automatically...
} |
2ba455bb-7bcf-41c4-ac91-086d980bf7e6 | 4 | public static int closestPoint(ArrayList<Point> points) {
Point min = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
int index = 0;
for (Point point : points) {
if (point.getY() < min.getY()) {
min = point;
index = points.indexOf(point);
... |
61c27b96-02a3-44a0-8850-1e303fa257c5 | 6 | public String getPermutation(int n, int k) {
boolean[] output = new boolean[n];
StringBuilder buf = new StringBuilder("");
int[] res = new int[n];
res[0] = 1;
for (int i = 1; i < n; i++)
res[i] = res[i - 1] * i;
for (int i = n - 1; i >= 0; i--) {
int s = 1;
while (k > res[i]) {
s++;
... |
d2233c71-5c45-4f12-b236-202914979e9d | 3 | protected Type getSuperClass(final Type t) {
if (currentClass != null && t.equals(currentClass)) {
return currentSuperClass;
}
Class c = getClass(t).getSuperclass();
return c == null ? null : Type.getType(c);
} |
ac816fc2-ea34-47d2-b8e0-0a1f25470a3c | 5 | public void buildMLD (MPDComponent mpdComponent, MLDCommand mld) {
String text, info;
MPDEntite ent, oldEnt ;
int cmp, nbId;
boolean isFirst;
mld.clear();
text = "# Modèle créé le : " + new java.util.Date() + " ;";
mld.addRequest(text);
oldEnt... |
0c022eea-26dd-4c2c-a7e8-1b1fbcf15178 | 7 | public static boolean isSameTree(TreeNode p, TreeNode q) {
if (null == p && null == q) return true;
if (p == q) return true;
if (null == p || null == q) return false;
return p.val == q.val && isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
} |
ea105a55-78c5-421e-a413-d021d21f8779 | 0 | public Constraint(final Builder builder) {
this.builder = builder;
} |
8d2c7616-3738-4563-9b23-02c3cd931ff3 | 3 | private void FillLists(){
try{
ResultSet AssetResults = null;
ResultSet ElementResults = null;
Statement GetAssets;
Statement GetElements;
... |
6d0df986-e765-49ec-bd50-bf776ce67cf9 | 2 | public void sortArray() {
this.arrayAccess = 0;
this.comparisions = 0;
heap.buildMaxHeap();
for (int i = this.array.length - 1; i >= 0; i--) {
try {
this.array[i] = this.heap.pop();
this.arrayAccess++;
} catch (EmptyCollectionExc... |
78792cf1-51c9-4d33-b360-0f599d7f1412 | 0 | public JButton getBoutons(int numBout) {
return boutons[numBout];
} |
663bcb7b-1969-4fa6-9e66-3cfd14a5c7f7 | 1 | @Override
public void run() {
System.out.println("thread started from "+start+" to "+stop );
for (int i = start;i<stop;i++){
text+=list.get(i);
}
GeoJsonReader.str[no]=text;
System.out.println("thread "+no+" done");
} |
eaa364fd-c5ea-42c0-aa11-fe438981ffbb | 4 | void copyHeadersExceptEncoding(HttpRequest request, HttpURLConnection conn) {
Map<String, List<String>> clientHeaders = request.getHeaders();
if (clientHeaders != null) {
for (String header : clientHeaders.keySet()) {
if (header.equalsIgnoreCase("accept-encoding")) {
... |
3d49a277-92ec-456e-a196-022917c986e5 | 4 | private Catalogue readCatalogue(ByteArrayInputStream inputStream) throws XmlException, IOException {
final Catalogue catalogue = new Catalogue();
try {
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
saxParser.parse(inputStream, new DefaultHandler() {
... |
ac92c789-8e85-4889-ba65-fafb542d572b | 3 | public static void copyStream(InputStream fin, OutputStream fout)
throws IOException
{
int bufsize = 4096;
for (int i = 0; i < 8; ++i) {
byte[] buf = new byte[bufsize];
int size = 0;
int len = 0;
do {
len = fin.read(buf, size, b... |
55b8ad29-4b58-457f-ab72-90042bc6b510 | 7 | public EigenvalueDecomposition (Matrix Arg) {
double[][] A = Arg.getArray();
n = Arg.getColumnDimension();
V = new double[n][n];
d = new double[n];
e = new double[n];
issymmetric = true;
for (int j = 0; (j < n) & issymmetric; j++) {
for (int i = 0; (i < n) & issymmetr... |
df811268-fb47-4bcc-a246-ae60eb7c0d4c | 1 | public void newConversation(String receiver) {
if(mMessageWindows.get(receiver) == null) {
MessageWindow window = new MessageWindow(receiver, this);
window.setVisible(true);
mMessageWindows.put(receiver, window);
}
else
mMessageWindows.get(receiver).setVisible(true);
} |
16026de4-be7e-4a32-b930-3637ace19529 | 8 | public HashMap<String, TreeSet<String>> parse(BufferedReader br) {
// functionMapIntra (function, caller set) is initialed
HashMap<String, TreeSet<String>> functionMapIntra = new HashMap<String, TreeSet<String>>();
String currentLine = null;
String currentNode = null;
// update
String key = "";
boolea... |
6ef8d4ca-38e7-4258-a651-2705a666a97c | 3 | synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
synchronized (org.omg.CORBA.TypeCode.class)
{
if (__typeCode == null)
{
if (__active)
{
return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
}
... |
be8eb55e-47a1-4059-b65b-d5197942415c | 6 | public static void directionsYouCanGo() {
Locale northDirection = map.currentLocale;
Locale southDirection = map.currentLocale;
Locale eastDirection = map.currentLocale;
Locale westDirection = map.currentLocale;
Locale downDirection = map.currentLocale;
Locale upDirection = map.currentLocale;
System.out... |
6492718e-f9a5-43b0-a968-d23a7966e5a4 | 4 | public void readFile() {
JSONParser jsonParser = new JSONParser();
try {
FileReader json = new FileReader("src/config.json");
Object obj = jsonParser.parse(json);
JSONObject jsonObject = (JSONObject) obj;
// Getting json values for SQL variables and DB
... |
9869cab0-1267-4dde-b4d8-5392cca25e5d | 4 | @Override
public ResultSet query(String query) {
//Connection connection = null;
Statement statement = null;
ResultSet result = null;
try {
this.connection = this.getConnection();
statement = this.connection.createStatement();
switch (this.getSta... |
01d973cc-b0d5-4132-9bac-30e695801a0a | 0 | public void setPlotBuilder(PlotBuilder plotBuilder) {
this.plotBuilder = plotBuilder;
addModel(plotBuilder);
} |
6b86bc43-c6b2-4b0d-9d40-a6d2a11f9cb2 | 9 | @Override
public String dismountString(Rider R)
{
switch(rideBasis)
{
case Rideable.RIDEABLE_AIR:
case Rideable.RIDEABLE_LAND:
case Rideable.RIDEABLE_WATER:
return "disembark(s) from";
case Rideable.RIDEABLE_TABLE:
return "get(s) up from";
case Rideable.RIDEABLE_SIT:
case Rideable.RIDEABLE_SLEEP... |
40e1ef5d-8b04-4b7c-9da9-f0508d4cc120 | 3 | @Override
public void evaluateLabels(Map<String, Integer> labelValues, int position)
throws TokenCompileError {
if(valueA.getData() != null)
valueA.getData().evaluateLabels(labelValues, position);
if(opcode.isBasic() && valueB.getData() != null)
valueB.getData().evalu... |
e64a0600-6215-4483-8745-6e7f8b78cdbb | 2 | public void testPrinterParserMethods() {
Period p = new Period(1, 2, 3, 4, 5, 6, 7, 8);
PeriodFormatter f2 = new PeriodFormatter(f.getPrinter(), f.getParser());
assertEquals(f.getPrinter(), f2.getPrinter());
assertEquals(f.getParser(), f2.getParser());
assertEquals(true, f2.isPri... |
a9af0dbf-7848-42f9-a51f-cc34e5fff6d8 | 4 | public String found() {
switch (ttype) {
case TT_WORD:
return sval;
case TT_NUMBER:
return Double.toString(nval);
case TT_EOL:
return "end-of-line";
case TT_EOF:
return "end-of-file";
default:
return (new Character((char) ttype)).toString();
}
} |
250666c8-ae9c-4fb4-bb36-36ab78111860 | 8 | protected Behaviour getNextStep() {
I.sayAbout(actor, "Getting next audit step... "+this.hashCode()) ;
I.sayAbout(actor, "Stage was: "+stage) ;
if (stage == STAGE_EVAL) {
if (audited == null && Rand.num() > (Math.abs(balance) / 1000f)) {
audited = nextToAuditFor(actor) ;
}
if ... |
f71280da-48c7-47ba-8169-4aea413ff861 | 4 | public static void main(String args[]) throws IOException {
Pqueue pq = new Pqueue();
int ch;
do{
System.out.println("1.ENCODE\n2.Display Table\n3.Exit");
System.out.print("Enter your choice: ");
Scanner in = new Scanner(System.in);
ch=in.nextInt()... |
96cfab23-a7d6-4683-bad3-8f541a71a0cf | 0 | @Override
public String getMobile() {
return super.getMobile();
} |
d45fa694-8f63-4b1b-9200-9b50aaea0e70 | 7 | private boolean ant_is_alive(int id, Colour col){
boolean found = false;
int x = 0;
int y = 0;
while(x < world.getRows() && !found){
while(y < world.getColumns() && !found){
Cell c = world.getCell(x,y);
if(c.isAnt()){
if(c.getAnt().getId()==id && c.getAnt().getColour()==col){
found = true;... |
753220f6-33c7-4015-9712-a12916e2cf65 | 6 | public boolean importData(TransferHandler.TransferSupport info)
{
GlobalLogger.getLogger().logp(Level.INFO, this.getClass().getName(),
"importData", "importData called.");
if (!info.isDrop())
{
return false;
}
// Get the task that is being dropped.
Transferable t = info.getTransferable();
Task t... |
6fc90e62-6b67-45b7-a964-44c7e5168807 | 8 | public static HashSet<String> getRegulatorTypedNamesByGenericProcessID(String gpid, PathCaseRepository repository) {
HashSet<String> set = new HashSet<String>();
ArrayList<ProcessToMoleculesTable.ProcessToMoleculesTableEntry> rows = repository.genericProcessToMoleculesTable.getRows(gpid);
if (r... |
55c90f44-847d-437d-8811-a131631cdeb6 | 2 | @Override
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
// font40 = new AngelCodeFont("res/fonts/04b03.fnt", new Image("res/fonts/04b03_0.png"));
font24 = new AngelCodeFont("res/fonts/font24.fnt", new Image("res/fonts/font24_0.png"));
font16 = new AngelCodeFont("res/fonts/font16.f... |
c4095631-f246-4373-aa61-e3c9abd01f1c | 1 | @Override
public Prototype copy() {
Prototype prototype = null;
try {
prototype = (Prototype) this.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return prototype;
} |
32fd71ca-0e25-40a6-83e6-f478b3046840 | 3 | public void startParseInput(String string, UserParser newParser){
if(string.equals("")) return;
if (newParser == null) {
try {
myParser = UserParser.get(grammar, string);
} catch (IllegalArgumentException e) {
JOptionPane.showMessageDialog(this, e.getMessage(), "Bad Input",
JOptionPane.ERR... |
698e582d-ea1c-4852-a223-52b812bff4c7 | 3 | public int checkadmins()
{
try
{
BufferedReader in = new BufferedReader(new FileReader("./data/administrators.txt"));
String data = null;
while ((data = in.readLine()) != null)
{
if (playerName.equalsIgnoreCase(data))
{
return 5;
}
}
}
catch (IOException e)
{
System.out.pri... |
bdc23321-3ea4-4f91-81e2-da9535e7f017 | 4 | public void plotPropagationCurves() {
double[] eRange = getEnergyRange();
PlotFrame frame = new PlotFrame("Energy", "Propagation", "QW Propagation Curves");
for (int i = 1; i < intervals.size() - 1; i++) {
if (intervals.get(i).getY() < intervals.get(i - 1).getY() && intervals.get(i).... |
e1216b65-f016-407e-909d-f2240ccbe5af | 2 | boolean isArithmetic(int[] arr) {
int d = arr[1] - arr[0];
for (int i = 2; i < arr.length; i++) {
if (arr[i] - arr[i - 1] != d) {
return false;
}
}
return true;
} |
c95f06c2-a0b8-45e8-b84c-b934b06d8c6c | 0 | public Collection<RoomEntity> getRooms() {
return rooms;
} |
77b2302c-2be4-454f-872c-c93d9be7c711 | 7 | public ArrayList<Move> generateAllPossibleMoves(boolean color) {
ArrayList<Move> moves = new ArrayList<Move>();
final List<Piece> listPiece;
// Sélectionne la liste des pièces selon la couleur
if (Helper.isColorWhite(color)) {
listPiece = whites;
} else {
listPiece = blacks;
}
// Parcours les pièc... |
bcb0a2ec-e38f-46d8-9ff3-02d63f77558e | 3 | @Override
public String toString() {
StringBuilder sb = new StringBuilder("\n");
for(int loop=0;loop<NUMBER_OF_OCCURRENCES_TO_BE_CONSIDERED_AS_BOT;loop++) {
sb.append(loop).append(":").append(slots[loop]).append(loop==oldestSlot ? "<-- oldest " :"").append(loop==lastEntry ? "<--... |
b6557ac0-adc2-4ca4-903f-54188d5ad127 | 7 | public void buscarDirectorio(String rutainicio, String mascara, boolean buscar, boolean pase) {
File directorioroot = new File(rutainicio);
File[] directorio = directorioroot.listFiles();
for (int i = 0; i < directorio.length; i++) {
if (directorio[i].isDirectory() && buscar == true)... |
e9af3aea-027b-4a69-b8df-797b99f0fde9 | 2 | public Station find(int id) {
Station station = new Station();
try {
ResultSet result = this.connect.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY).executeQuery("SELECT * FROM eleve W... |
e8631858-5ba2-4476-aac0-73c5f58925b3 | 6 | public void printParentheses(int l, int r, char ch[], int count) {
if(l==0 && r==0)
System.out.println(ch);
if( l<0 || r<1) return;
else {
if(l>0) {
ch[count] = '(';
printParentheses(l-1, r, ch, count+1);
}
if(r>l) {
ch[count]=')';
printParentheses(l, r-1, ch, count+1);
}
}
} |
dd5c6289-dfc1-4773-a5b1-ba70a6f6a3e1 | 3 | public Connection(InetSocketAddress address){
try {
this.selector = Selector.open();
} catch (IOException e) {
LOGGER.severe("Could not open Selector! " + e.getMessage());
System.exit(1);
}
try {
this.channel = SocketChannel.open(address);
... |
87237bfc-2811-4e09-8b48-daaf54b85125 | 1 | public void atualizar(Curso curso) throws Exception
{
String sql = "UPDATE curso SET nome = ? WHERE id = ?";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
stmt.setString(1, curso.getNome());
stmt.setLong(2, curso.getId());
stmt.executeUpdate();
}
catch (... |
d0eb4902-acee-4393-b77e-c3ef81e5d9d4 | 5 | public boolean load(final ILoad load) {
switch ( this.options.getType( ) ) {
case FILE:
final File file = new File((String) this.options.getArgument("target"));
if ( !file.exists( ) )
try {
if ( !file.createNewFile( ) )
throw new IOException( );
} catch ( final IOException e ) {
return... |
f3dacd6f-adb6-42be-9f72-96ffd2dca80f | 1 | public void startServer() {
System.out.println("Starting server...");
try {
startServer(9876);
System.out.println("Server started!");
} catch (CouldNotStartServerException e) {
System.out.println("Server could not be started: " + e.getMessage());
}
} |
f75c095c-8b43-41a0-ace3-60b56d7e44ad | 5 | @Override
public ElectionResult getElectionResult() {
if (published && electionResult == null)
switch (type) {
case SIMPLEPLURALITY:
electionResult = new DnDSimplePluralityResult(this);
break;
case ALTERNATE:
electionResult = new DnDAlternativeVoteResult(votes, getCandidates());
break;
ca... |
6111aeb0-c53a-41c4-b4fe-b1b5763f1a41 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
Physical target=mob;
if((auto)&&(givenTarget!=null))
target=givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",... |
69c0fab8-d32a-4729-8dab-15c488893751 | 8 | public boolean equals(Object _other)
{
if (_other == null) {
return false;
}
if (_other == this) {
return true;
}
if (!(_other instanceof Group)) {
return false;
}
final Group _cast = (Group) _other;
if (id != _cast.id) {
return false;
}
if (idModified != _cast.idModified) {... |
379d08b5-0709-495e-80c3-042f61fcf95b | 5 | private void txtPrixKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPrixKeyTyped
if (!Character.isDigit(evt.getKeyChar()) && evt.getKeyChar()!='.' && evt.getKeyChar()!=KeyEvent.VK_BACK_SPACE )
{
getToolkit().beep();
JOptionPane.showMessageDialog(null, "Veuillez entrez ... |
08b316b8-fdcb-4c41-8109-f586c773fdff | 3 | @Override
public void actionPerformed(ActionEvent e) {
//If the modSelection JComboBox is used, record the user selected modifier
if ("modSelected".equals(e.getActionCommand())){
selectedModIndex = modSelection.getSelectedIndex();
}
//If the clear button is pressed, empty the JTextAreas and set totalMod to ... |
90b2133c-44a9-4303-ad26-fadb83b18a67 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
TreeNode<?> other = (TreeNode<?>) obj;
if (data =... |
40685772-230c-4e5e-ba41-ce76cb8b33bb | 2 | public static JSONObject toJSONObject(String string) throws JSONException {
JSONObject jo = new JSONObject();
HTTPTokener x = new HTTPTokener(string);
String token;
token = x.nextToken();
if (token.toUpperCase().startsWith("HTTP")) {
// Response
jo.p... |
228b4547-d4dc-40ac-a529-40e0f507efe6 | 7 | @Override
public String makeMobName(char gender, int age)
{
switch (age)
{
case Race.AGE_INFANT:
case Race.AGE_TODDLER:
return name().toLowerCase() + " pinkie";
case Race.AGE_CHILD:
switch (gender)
{
case 'M':
case 'm':
return "boy " + name().toLowerCase() + " pup";
case 'F':
case '... |
7fe245ba-d818-4c81-a34e-fef3a4a47b79 | 7 | public void stepSim(long timeStep) {
long endTime = this.curTime + timeStep;
try {
Connection con = EpiSimUtil.dbConnect();
PreparedStatement getInfected = con.prepareStatement(
"SELECT infectedID FROM "+EpiSimUtil.dendroConTbl+" WHERE victimID = ?");
Statement getTransEvents = con.createStatement();
... |
67a01f84-c079-4874-aabd-40ad1b2c5165 | 8 | public void destroy() {
setAction(null);
MouseListener[] ml = getMouseListeners();
if (ml != null) {
for (MouseListener i : ml)
removeMouseListener(i);
}
ActionListener[] al = getActionListeners();
if (al != null) {
for (ActionListener i : al)
removeActionListener(i);
}
ItemListener[] il =... |
5388222e-4ab1-493b-bc06-2bbd8f9bee7d | 2 | @Override
public List<? extends DefaultModel> getObj(String campo) {
if (campo.equals("Produtos")) {
return Produto.service.findAll();
}
return null;
} |
21907d04-7300-417d-ae1a-b3a063915b8b | 0 | public LetThereBeLandCommand(String label, Panel p) throws HeadlessException {
super(label);
this.p = p;
} |
17b62f46-8be2-4e75-afed-1d045eab1826 | 5 | public void mouseClicked(MouseEvent event) {
if (event.getModifiers() == event.BUTTON1_MASK) {
if (event.getClickCount() == 1
&& controller.isVertex(event.getPoint())) {
controller.renameVertex(event.getPoint());
} else if (event.getClickCount() == 1
&& controller.isEdge(event.getPoint())) {
c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.