method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1465ece1-9989-462a-988e-6da0e8e07f32 | 4 | public int compareTo( Casella casella )
{
if ( fila < casella.fila )
{
return -1;
}
else if ( fila > casella.fila )
{
return 1;
}
else if ( columna < casella.columna )
{
return -1;
}
else if ( columna > casella.columna )
{
return 1;
}
else
{
return 0;
}
} |
15b1b17f-d53f-4e4c-a512-95f894def4c1 | 1 | public int compare(Person p1, Person p2){
int result = p2.getName().compareTo(p1.getName());
if(0==result){
return p2.getId() - p1.getId(); //若姓名相同则按id排序
}
return result;
} |
6b6f5d93-03f4-4ecb-b83c-10eaee0e972e | 1 | public void test_now_nullDateTimeZone() throws Throwable {
try {
DateTime.now((DateTimeZone) null);
fail();
} catch (NullPointerException ex) {}
} |
ecae0044-3101-4694-87f8-a5f5f517c578 | 0 | public MACMethodType getMACMethod() {
return macMethod;
} |
9164901e-ebc0-42a0-a862-04be8ad891b5 | 8 | private void run(String[] args) throws Exception {
if (args == null || args.length < 1 || args.length >2) {
System.out.println();
System.out.println(" ##################################################################################");
System.out.println(" # IMDB Tool, Us... |
f11fecfb-2b29-400a-87b5-778629df7401 | 7 | public Terrain(Map map) {
this.mapRenderer = new OrthogonalTiledMapRenderer((TiledMap) map, 1);
camera = new OrthographicCamera(960, 640);
camera.translate(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
camera.update();
this.mapRenderer.setView(camera);
rocks = new Array... |
fead6894-2fa4-4587-a209-e77bbc71d658 | 4 | public static void countUsedHJs(Data data) throws WeFuckedUpException {
int usedHJs = 0;
for (Subject thisSubject : data.subjects) {
for (Semester thisSemester : thisSubject.semesters) {
if (thisSemester.usedState != UsedState.none) {
usedHJs++;
... |
098d9096-d3b3-48bd-9db2-62711d0d593f | 3 | protected double getAngleFromVelocity() {
double angle = 0.0f;
float slope = 0.0f;
if(velocityX == 0.0f) {
if(velocityX > 0.0f) {
angle = Math.PI / 2;
} else {
angle = -Math.PI / 2;
}
} else {
slope = -veloci... |
e3adff52-9968-46bd-9883-9144c2418704 | 4 | public static Graph randomTree3() {
int depth = 10;
Graph graph = new Graph(depth * 50, depth * 50);
int a = 0;
int b = 1;
int c = 0;
graph.addVertex(new Vertex(c++, 25 + 25 * (depth - 1), 25));
for (int i = 1; i < depth; i++) {
for (int j = 0; j <= i; j++) {
graph.addVertex(new Vertex(c++, 25 +... |
3520015f-8d7d-426f-8a70-6eefdad91928 | 3 | public void append(String str)
{
int newsize = this.size + str.length();
// If there's insufficient capacity, make a new array
if (newsize >= this.contents.length)
{
char[] oldcontents = this.contents;
this.contents = new char[computeCapacity(newsize)];
for (int i = 0; i < t... |
4876e101-d6f0-4457-a65d-4d03e8086bbc | 1 | public static String getProfile() {
StringBuffer sb = new StringBuffer();
sb.append("OS = " + System.getProperty("os.name") + " (" + System.getProperty("os.version") + "), " + System.getProperty("os.arch")
+ "\n");
sb.append("Java Version = " + System.getProperty("java.version") ... |
d31cbc28-c6c5-498d-8758-68d6f47a7a6b | 0 | public void windowDeactivated(WindowEvent e) {
System.out.println("Die Anwendung wurde deaktiviert...");
} |
bbee2a4d-8e04-4066-aa85-80786b181089 | 1 | public void testGetName_berlin() {
DateTimeZone berlin = DateTimeZone.forID("Europe/Berlin");
assertEquals("Central European Time", berlin.getName(TEST_TIME_WINTER, Locale.ENGLISH));
assertEquals("Central European Summer Time", berlin.getName(TEST_TIME_SUMMER, Locale.ENGLISH));
if (JDK6) {
... |
f39e7301-2dfc-46e3-93d7-efc5c08f83f4 | 5 | private static void appendJSONPair(StringBuilder json, String key,
String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
}
} catch (NumberFormatException e) {
... |
452bc88d-76b4-4c9c-b8ad-86966a576a91 | 6 | public void makeMovesFromTree(List<Move> moves) {
gameOver = false;
int moveCount = 0;
for (Move move : moves) {
if (move instanceof InitialPosition) {
InitialPosition initialPosition = (InitialPosition) move;
board = new Board(board.boardSize, initialPosition.handicap);
} else if (move instanceof... |
50b8aba8-8f55-420e-bd26-d4e00c0ad8bc | 4 | private TileLayer extractData(Node datanode, TileDataEncoding encoding,
TileDataCompression compression, int width, int height, String name, Properties properties, boolean visible, float opacity)
throws XPathExpressionException, JTMXParseException {
int[] data = new int[width * height];
if (encoding.equals... |
c3ce37e4-8b46-49cc-8fb4-ac28e804d167 | 3 | public void appendLinkedQuestion(LinkedQuestion question) throws Exception {
if (question.options.size() == 0)
throw new Exception("Question has no options.");
for (String target : question.targets) {
LinkedList<AbstractQuestion> playersActiveQuestions = activeQuestions.get(target.toLowerCase());
if (pl... |
217bcdeb-afc2-4c1b-ad15-5977c362832a | 7 | static String printGuitarStyles(final Program program) {
StringBuilder sb = new StringBuilder();
if (program.isAcoustic()) {
sb.append("Acoustic, ");
}
if (program.isBass()) {
sb.append("Bass, ");
}
if (program.isBlues()) {
sb.append("B... |
ed6da0a3-4137-4a46-802c-e84d7f6afb27 | 4 | private String getNextLine() throws IOException {
if (!this.linesSkiped) {
for (int i = 0; i < skipLines; i++) {
br.readLine();
}
this.linesSkiped = true;
}
String nextLine = br.readLine();
if (nextLine == null) {
hasNext = fal... |
675c5922-8b47-484f-901b-b622eef3febf | 6 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
ArrayList<Double> eachTurn = new ArrayList<Double>();
int num_turn = in.nextInt();
double posSum = 0;
double negSum = 0;
double result = 0.0;
double avg = 0.0;
double sum = 0.0;
System.out.println(Math.round(0.5));
while(nu... |
36b0f61d-4134-47c5-8d34-58600a7de970 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Cube other = (Cube) obj;
if (identifier == null) {
if (other.identifier !... |
cdb10703-ec2c-4b36-a73c-990d8ed7a3ba | 3 | public void getEnvironmentData () {
ResultSet rs = Main.mysql.getData("SELECT id, name, description FROM `environments`");
try {
while (true) {
environmentData.put(rs.getInt(1) + ":name", rs.getString(2));
environmentData.put(rs.getInt(1) + ":desc", rs.getStri... |
14c876d6-9b59-4cf7-8f7c-1cf129dd90c9 | 0 | public void treeStructureChanged(TreeModelEvent e) {
invalidate();
} |
40a2e9e8-9684-460e-871a-da61c5c4612a | 3 | public void IndexReader(String filename)
{
// create new file reader
FileReader fR;
try
{
// Initialise new file reader and give passed in filename
fR = new FileReader(filename);
//create and initialise buffered reader
BufferedReader bR = new BufferedReader(fR);
String indexWord;
int coun... |
1221c06d-bc14-4c27-a1a7-dfd4be5a3a77 | 1 | public ManifestReaderImpl() {
try {
URLClassLoader cl = (URLClassLoader) getClass().getClassLoader();
URL url = cl.findResource("META-INF/MANIFEST.MF");
Manifest manifest = new Manifest(url.openStream());
Attributes attrs = manifest.getMainAttributes();
... |
0b15bf94-ac51-40e5-ac97-7b471f1b5120 | 0 | public String getPassword() {
return password;
} |
a7c02e96-101a-4e4e-8ba5-c7ffe36e2949 | 0 | RLOGIndividuals() {
this.uri = "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#" + name();
} |
cf974ad0-de58-4c03-8c0b-1c1fc5e22b51 | 3 | public static void chooseBiome(Scanner scan, Character player, Random generator) {
System.out.println("Select your biome (enter the number): \n");
Biome[] startBiomes = new Biome[5];
for(int i = 0; i < startBiomes.length; i++) {
int selection = generator.nextInt(Arrays.biomes.length);
startBiomes[i] =... |
0d80fc1e-47c8-4190-8fd4-9e45b2317b48 | 3 | public static int validInput(int choice, int max, int min) throws IOException
{
int newChoice = choice;
BufferedReader r = new BufferedReader (new InputStreamReader(System.in));
boolean valid = false;
while (!valid)
{
if (newChoice >= min && newChoice <= max)
{
valid = true;
}
... |
8bb4d07f-da9f-47fb-8248-a30826f517aa | 7 | public void generateData(int n, TimeComplexity complexity){
super.generateData(n, complexity);
if(isHeap)
heap.clear();
else
bst.clear();
if(complexity.equals(TimeComplexity.AVERAGE) || (!isHeap &&complexity.equals(TimeComplexity.BEST)))
data = Helper.permutedInts(n);
else if(complexity.equals(Ti... |
c562ed6e-066b-4ced-829e-4801a6ed8ee2 | 7 | public static ListNode removeNthFromEnd(ListNode head, int n) {
ListNode slow = head;
ListNode fast = head;
int x = n;
while (x >= 0 && fast != null) {
fast = fast.next;
x--;
}
if (fast == null && x > 0) {
return head;
}
... |
7bec7c76-033a-40d6-830b-736ec3f8c486 | 9 | private static Method getMethod(int requireMod, int bannedMod, Class<?> clazz, String methodName, Class<?>... params) {
for (Method method : clazz.getDeclaredMethods()) {
// Limitation: Doesn't handle overloads
if ((method.getModifiers() & requireMod) == requireMod &&
(me... |
6ccda008-a680-4814-a00b-4f583f4e3f3b | 3 | @Override
@SuppressWarnings("unchecked")
public T next() {
if (hasNext()) {
if (mIterator == null) {
Row row = mList.get(mIndex++);
if (row.hasChildren()) {
mIterator = new RowIterator<>(row.getChildren());
}
return (T) row;
}
return mIterator.next();
}
throw new NoSuchElementExce... |
1fffb2b8-93bd-496f-8d6d-2fb063bce365 | 4 | public ItemQuery<Item> getItemsInTab(BankTab tab) {
final int[] count = getTabCount();
switch (tab) {
case ONE:
int total = 0;
for (Integer i : count) {
total += i;
}
return skip(select(), total);
default:
int skip = 0;
int take = 0;
int x = 0;
while (x < count.length) {... |
0a81ceba-7518-4bc0-9ff3-a77d7125c3ce | 8 | public List<Files> Search_file(String projectName, String fileName, String format)
{
String query1 = "SELECT distinct e.projID from project e WHERE e.projName='"+projectName+"'";
EntityManagerFactory emf = Persistence.createEntityManagerFactory("PersistenceUnit");
EntityManager manager = emf.createEntit... |
c63a266d-3e00-40d2-afa8-f036dc58d49b | 1 | public boolean isFPSStatus() {
if(frame == null) buildGUI();
return fpsStatus.isSelected();
} |
8698289e-eaa1-40ae-a03a-54a56e19277e | 7 | public GameSettings GetSettings()
{
if (this.GetMode() == null) return null;
BufferedImage[] Images = new BufferedImage[2];
try
{
SneekReader Reader = SneekReader.GetReader(new File(FileHelper.GetDataFolder(), this.GetMode() + this.ModeFileSuffix));
String RawData = null;
while ((RawData = Reader.read... |
f162cc38-71a5-4348-bb00-70db1ebe0a4a | 7 | protected static void copyOrMove(File sourceLocation, File targetLocation, boolean move) throws IOException {
String[] children;
int i;
InputStream in;
OutputStream out;
byte[] buf;
int len;
if (sourceLocation.isDirectory()) {
if (!targetLocation.exists())
targetLocatio... |
39c6e5e5-8d0f-4fcb-9fd4-009c543e6662 | 8 | private void generateHouse(){
int width=(int)Math.round(Math.random()*30)+20;
int height=(int)Math.round(Math.random()*30)+20;
this.gMap=new Vertex[height][width];
char[][] generatedHouse = new char[height][width];
for(int y=0; y<height; y++){
for(int x=0; x<width; x+... |
6a7119c2-606e-4df7-8e7a-4a2f7c8de444 | 7 | public int openSpot(int x, int y) {
if (usrGrid[x][y])
return ansGrid[x][y];
usrGrid[x][y] = true;
--numSpacesLeft;
theGUI.openSpot(x, y, false);
if (ansGrid[x][y] == 9) {
openBombs();
if (gameState == 0)
gameState = 2;
else if (gameState == 1)
return 9;
else {
//System.out.println(... |
f6b5d350-3f96-405c-96dd-de3fc6fe065f | 0 | @Override
public int getYearsExperience() {
return super.getYearsExperience();
} |
5590164f-3fec-41e7-aad4-e3bba814227f | 0 | public void setPlayerBust(boolean x){
playerBust=x;
} |
716323c1-591f-451a-ad80-14b4409e9530 | 5 | @Override
public int compareTo(Point that) {
if (this.x == that.x && this.z == that.z) {
return 0;
}
if (this.x == that.x) {
if (this.z < that.z) {
return -1;
}
return +1;
}
if (this.x < that.x) {
return -1;
}
return 1;
} |
cc3583c0-666c-463e-8bec-5a1aafb3e76d | 7 | public int readRawVarInt() throws IOException {
byte tmp = readRawByte();
if (tmp >= 0) {
return tmp;
}
int result = tmp & 0x7f;
if ((tmp = readRawByte()) >= 0) {
result |= tmp << 7;
} else {
result |= (tmp & 0x7f) << 7;
if ((tmp = readRawByte()) >= 0) {
result |= tmp << 14;
} else {
... |
dc185f75-28ce-4385-8bb6-4c3879dd41f9 | 4 | @Override
public boolean delete(Hotelier x)
{Statement stm = null;
try
{
stm = cnx.createStatement();
int n= stm.executeUpdate("DELETE FROM hotelier WHERE id='"+x.getHotelierId()+"'");
if (n>0)
{
stm.close();
return true;
}
}
catch (SQLException exp)
{
}
finally
{
if (stm!=null)
try {
... |
c4bf5028-a0e7-44a6-a3be-32a15b4edb6a | 1 | public void insertGenesOnPos(List<Bin> genes, int y) {
if(y >= this.bins.size()){
y = this.bins.size();
}
this.bins.addAll(y, genes);
} |
005178e9-95c7-455d-8a97-90a96f70ad99 | 0 | public PacienteFacade() {
super(Paciente.class);
} |
b921e995-a83b-4ea6-b3ff-56f451c99132 | 0 | @Override
public String toString() {
String result = "Concepto: " + this.getConcepto() + ", Importe: " + this.getImporte() + ", Fecha: " + this.getFecha();
return result;
} |
a4580fe6-425a-48ec-922d-79fa34608cc7 | 6 | public SQLConnection(){
try {
BufferedReader br = new BufferedReader(new FileReader("C:/windows/journal.txt"));
String buffer, result3 = null , result2 = null, result1 = null , result4 = null;
int i=0;
while ((buffer = br.readLine()) != null) {
... |
6f9bd838-b9fe-487d-89a6-49aa744d5834 | 8 | public static void buyTicketsConnect(User usr) {
clearConsole();
if (usr == null) {
HomePage();
} else {
System.out.println ("*******************************");
System.out.println ("**** Tickets Shop ****");
System.out.println ("*******************************");
System.out.println ("Hi "+usr.getUs... |
5f5621e0-2e05-4840-8f8e-72e59e6b7984 | 6 | @Override
public void startTransfer() throws TransferException {
Runnable r = new Runnable() {
public void run() {
try {
ByteWriter writer = new ByteArrayWriter();
// 最开始执行了一个i请求
writer.write("SIPP".getBytes());
if (!tryExecuteRequest("i", requestId++, writer, 1))
raiseException(new ... |
14312e61-4e70-47cc-acf9-b19ba07ed494 | 7 | public State[] getNondeterministicStates(Automaton automaton) {
LambdaTransitionChecker lc = LambdaCheckerFactory
.getLambdaChecker(automaton);
ArrayList list = new ArrayList();
/* Get all states in automaton. */
State[] states = automaton.getStates();
/* Check each state for nondeterminism. */
for (int... |
2840698d-735d-44c4-bba2-09e961161bec | 7 | @Override
public boolean equals(Object edge) {
if (edge == null) return false;
if (edge == this) return true;
if (!(edge instanceof Edge))return false;
Edge compared = (Edge)edge;
if ((compared.getFrom() == this.getFrom()
&& compared.getTo() == this.getTo())
||(compared.getTo()... |
71fa958d-5971-45f8-8315-07bdb68a5a6a | 0 | public void test(){
} |
211646f7-c6d6-454d-9d7b-2f24194daf84 | 5 | public static String extract(String line, String key) {
if (line == null) {
return null;
}
String code = extractCode(line);
int i = code.indexOf(key + assign);
if (i == -1) //key not found
{
return null;
}
int end = code.indexOf(sep... |
d6a749dd-7760-4237-8c33-70cedfe54402 | 1 | public TableSwitchInsnNode(
final int min,
final int max,
final LabelNode dflt,
final LabelNode[] labels)
{
super(Opcodes.TABLESWITCH);
this.min = min;
this.max = max;
this.dflt = dflt;
this.labels = new ArrayList();
if (labels != null)... |
f052f906-01b3-4425-82c7-0ebda7f1004b | 4 | public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... |
72bee8c5-ce5b-4bc0-a824-aebd7559e6dd | 1 | public long skip(long size) throws IOException
{
long skipped = super.skip(size);
if (skipped > 0L) {
this.monitor.addProgress(skipped);
}
return skipped;
} |
af56b50b-0e2c-41e8-b589-6c7da2680749 | 5 | @Override
public void actionPerformed(ActionEvent evt) {
if (MainWindow.tripDB.getCheckErrors() + MainWindow.tripDB.getCheckWarnings() > 0)
if ( JOptionPane.showConfirmDialog(null,
"Die Planung enth\u00E4lt\n " +
MainWindow.tripDB.getCheckErrors() + " Fehler und\n " +
MainWindow.tri... |
dbc107cb-9ba2-4906-ad9e-05bfd723caf5 | 3 | private void spawnRandom(){
Random random = new Random();
boolean notValid = true;
while(notValid){
int location = random.nextInt(ROWS * COLS);
int row = location / ROWS;
int col = location % COLS;
Tile current = board[row][col];
if(current == null){
int value = random.nextInt(10) < 9 ? 16 :... |
3d131595-e7a8-439d-9607-ae948eee6f45 | 2 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.orders");
String prevPage = (String) request.getSessionAttribute(JSP_PAGE);
resaveParamsShowOrder(request);
formOrderList(request);
... |
196ad4cb-a608-4ba8-a81e-e676acc7be68 | 7 | public static int solution(int[] A) {
int len = A.length;
if (len <= 0) {
return -1;
}
int leader = A[0];
int counter = 0;
/* Find the Leader */
for (int i = 0; i < len; i++) {
if (A[i] == leader) {
counter++;
} else {
if (counter == 0) {
leader = A[i];
counter++;
} else {
... |
bb5c9bfa-7195-476f-ac27-1c918d4b396d | 0 | public int getAge()
{
return Age;
} |
b11e15b4-664e-40a8-b4e8-0a573d8040e8 | 3 | public void run() {
try {
String line;
while (!isInterrupted()) {
line = in.readLine();
if (line != null)
get(line);
else
close();
}
} catch (IOException exc) {
close();
}
} |
a32f3824-66f0-4eff-9d9c-ca992fe1545e | 5 | private HBox getCustomButtons(String[] buttonLabels, T[] buttonValues, boolean addCancelButton) {
if (buttonLabels == null || buttonValues == null) throw new NullPointerException("null argument");
if (buttonLabels.length != buttonValues.length) throw new IllegalArgumentException("different lengt... |
5d04e658-c26f-49aa-a093-10308743c504 | 3 | public void recusarTema(List<Tema> listaTemas, int temaEscolhido) {
Tema escolhido = null;
if (listaTemas != null) {
for (int i = 0; i < listaTemas.size(); i++) {
if (i == temaEscolhido - 1) {
escolhido = listaTemas.get(i);
break;
... |
1b9bf730-a7fb-42d0-b0e0-bc53c633e686 | 9 | public void setOptions(String[] options) throws Exception {
String tmpStr;
setRawOutput(Utils.getFlag('D', options));
setRandomizeData(!Utils.getFlag('R', options));
tmpStr = Utils.getOption('O', options);
if (tmpStr.length() != 0)
setOutputFile(new File(tmpStr));
tmpStr = Utils.get... |
ac7924f2-0759-456e-b61b-2e80148527ae | 6 | protected static Nodo buscarPrivate(Nodo raiz, int dato)
{
if(raiz == null)
return null;
else if(raiz.getDato() == dato)
return raiz;
else if(raiz.getOpt1() != null)
return Arbol.buscarPrivate(raiz.getOpt1(), dato);
else if(raiz.getOpt2(... |
0d524872-6219-47c6-8b48-ff906c505b97 | 4 | public boolean equals(Object ob) {
if ( !(ob instanceof PointerBuffer) )
return false;
PointerBuffer that = (PointerBuffer)ob;
if ( this.remaining() != that.remaining() )
return false;
int p = this.position();
for ( int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j-- ) {
long v1 = this.g... |
d03e2da2-b05e-4153-b6de-0f2ae4ac8546 | 4 | public synchronized void receive(File file, boolean resume) {
if (!_received) {
_received = true;
_file = file;
if (_type.equals("SEND") && resume) {
_progress = file.length();
if (_progress == 0) {
doReceive(fi... |
71b80426-8a8b-402c-802f-fdfa739f835f | 9 | public static void packMessage(String message, Stream buffer) { // method526
if (message.length() > 80) {
message = message.substring(0, 80);
}
message = message.toLowerCase();
int tmp = -1;
for (int i = 0; i < message.length(); i++) {
char c = message.charAt(i);
int k = 0;
for (int j = 0; j < Pla... |
324423ed-fe52-41ed-9dc1-a4f54847507d | 7 | public void determineBounds() {
double value,min,max;
// find maximums minimums over all plots
m_minX = ((PlotData2D)m_plots.elementAt(0)).m_minX;
m_maxX = ((PlotData2D)m_plots.elementAt(0)).m_maxX;
m_minY = ((PlotData2D)m_plots.elementAt(0)).m_minY;
m_maxY = ((PlotData2D)m_plots.elementAt(... |
6e30be0b-6f4a-4a35-bb14-50833ef5a6b8 | 0 | public String getName(){
return name;
} |
d23d2ee6-06f8-4970-bcdf-70b98721eca4 | 7 | static void addTest() {
int numBlocks = 100;
int[] x = new int[numBlocks];
int[] y = new int[numBlocks];
int[] z = new int[numBlocks];
Set<String> s = new TreeSet<String>();
BlockWorld world = new BlockWorldImpl();
Random r = new Random(1);
log.info("Adding blocks");
for (int i = 0; i < numBlocks; ... |
61663b51-8099-4c2c-8cd7-ade33ac4752d | 3 | public int eliminarUsuario(String code){
int condicion = 0;
tablaDeUsuarios();
for(int i = 0; i < data.size();i++){
String valorEliminar = data.get(i).getCode();
if(valorEliminar.equals(code)){
... |
56745515-95ac-4382-b98f-5f163b53eb99 | 4 | public static void main(String[] args) throws IOException
{
//read in data for different kinds of classes
BufferedReader citizenReader = new BufferedReader(new FileReader("citizen.txt"));
//BufferedReader resourceReader = new BufferedReader(new FileReader("resourcepool.txt"));
B... |
a224312b-333a-424d-8264-e10c815700f2 | 1 | public void toggleVisibility() {
if (isShowing()) {
pop();
} else {
push(defaultMenu);
}
} |
9286bc7e-4d0e-4f71-aebc-141945dfe719 | 5 | @Test
/**
* Test if the Queue remains consistent after a deletion
*/
public void testQueueConsistencyOnDeletion() {
//Add elements
Memory.put("car1", "ferrari");
Memory.put("car2", "toyota");
Memory.put("car3", "honda");
//Get the first version of the queue
LinkedList<Node> list1 = (LinkedList<... |
bb88a3c2-387e-4c4b-a20a-3ad947c7a821 | 2 | private static void stringSim(String str) {
int totalCount = str.length();
for (int i = 1; i < str.length(); i++) {
if (kmpSearch(str, str.substring(i))) {
System.out.println(str.substring(i));
totalCount += str.substring(i).length();
}
}
System.out.println(totalCount);
} |
d7ae491d-244f-43ba-afde-7f5a30087317 | 1 | List<IntKeyValuePair> getKeyValuePairs() {
List<IntKeyValuePair> kvpList = new ArrayList<IntKeyValuePair>();
iter = bucket.iterator();
while(iter.hasNext()) {
kvpList.add(iter.next());
}
return kvpList;
} |
8b9c8abf-16a9-4691-aeef-98a83a474c71 | 7 | public void create(InfoPaciente infoPaciente) {
if (infoPaciente.getPypAdmAgendList() == null) {
infoPaciente.setPypAdmAgendList(new ArrayList<PypAdmAgend>());
}
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
... |
61f08ed5-b8bd-4cce-81e3-9a02b6c7a858 | 1 | private synchronized void sendOutboundData() {
mOutboundData.flip();
int limit = mOutboundData.limit();
if (limit > 0) {
ByteBuffer buffer = ByteBuffer.allocate(limit);
buffer.put(mOutboundData);
buffer.flip();
mSession.getServer().send(mSession.getChannel(), buffer);
}
mOutboundData.clear();
} |
b9ef993f-cab9-411a-b2d0-9027c609d908 | 4 | private void asignarEtiquetas() {
_columnas.actualizarPregunta("<html>"+_preguntas.get(_posicion).getPregunta()+"</html>");
for (int i = 0; i < _columnaBRevuelta.size(); i++) {
_columnas.asignarColumnaLetrasB("<html>"+_columnaBRevuelta.get(i).getRespuesta()+"</html>", i);
_column... |
6e39a17f-81d7-4fc9-ad7c-7f10c12337a8 | 5 | @SuppressWarnings("deprecation")
public void crear(){
if (tFnombre_usuario.getText().isEmpty() || passwordField.getText().isEmpty() || tFemail.getText().isEmpty()){
JOptionPane.showMessageDialog(contentPane,"Algunos campos estan vacios.","Advertencia",JOptionPane.INFORMATION_MESSAGE);
}else{
if (chequearCont... |
e228f006-ff32-472c-ad7d-fc34eb8d03c2 | 4 | public Image getImageFor(FieldType fieldType) {
switch (Core.TILESIZE) {
case 8 :
return images8.get(fieldType.name());
case 16 :
return images16.get(fieldType.name());
case 24 :
return images24.get(fieldType.name());
... |
bd965745-5802-449e-84fb-66d9e1c36587 | 5 | private void field_cta_nroFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_cta_nroFocusLost
if (lab_modo.getText().equals("Baja") || (lab_modo.getText().equals("Modificación"))){
if (!field_cta_nro.getText().equals("")){
if(existeCta(Integer.parseInt(field_cta_nro.ge... |
f1e34e31-8367-430c-994a-1df7ff14f49a | 1 | public void testDivisionAndAddition() throws NumberFormatException, MalformedParenthesisException, MalformedDecimalException, InvalidOperandException, MalformedTokenException {
List<String> basicStrings = new ArrayList<String>();
basicStrings.add("6.0/3.0 + 1");
basicStrings.add("6.0/3 + 1");
basicStrings.ad... |
68bd30e6-dfd4-4f6c-9bc7-a00b2f22e2f2 | 8 | @Override
public void run()
{
this.setVisible(true);
if (this.GamePanel.getBackground() != this.BackgroundColor)
{
this.GamePanel.setBackground(this.BackgroundColor);
try
{
Thread.sleep(500L);
}
catch (InterruptedException e)
{
new SPopup(new SPopupData(e));
}
}
while (this.GetG... |
df0d9ad1-8a41-45d2-854c-827218f3bf2f | 4 | public static void supprimerReponse(Reponse reponse, Utilisateur utilisateur) {
if (!reponse.peutSupprimer(utilisateur))
throw new InterditException("Vous n'avez pas les droits requis pour modifier cette réponse");
if (reponse.getSujet().getReponsePrincipale().equals(reponse)) {
... |
732ccae2-167e-4984-987a-26a59d3f7ec3 | 1 | public String toString() {
return "piece" + (this.valid ? "" : "!") + "#" + this.index;
} |
0dca62c2-8407-4443-b253-9531a3e49b2d | 3 | private void stopThreads() {
updateEntities.stop();
hitBoxManager.disableCollisions();
for(int i=0; i<invader1.getEntityCount(); i++) {invader1.stopAnimation();}
for(int i=0; i<invader2.getEntityCount(); i++) {invader2.stopAnimation();}
for(int i=0; i<invader3.getEntityCount(); i++) {invader3.stopAnimat... |
5db53bcb-cba3-4b25-8d86-796128c28d53 | 7 | @Override
public Class<?> getColumnClass(int columnIndex) {
Class<?> clazz;
switch (columnIndex) {
case 0:
case 3:
case 4:
clazz = Integer.class;
break;
case 1:
case 2:
clazz = String.class;
... |
9eb838d3-f7ad-46ee-bfbc-92475113b484 | 4 | public static void tagger(String devDataFile, String countFile,
String trainDataFile) throws IOException {
HashMap<String, Integer> wordToCount = HMMHelpers.rareWordMarker(
"ner_0.counts", trainDataFile);
HashMap<String, TreeMap<Double, String>> emissionParams = HMMHelpers
.eParamsCalculator(countFile);... |
e6cf9666-ffde-488e-9305-a2ce7e53bf38 | 6 | public static Cons yieldStructSlotTrees(Stella_Class renamed_Class) {
{ Cons structslotdefs = Stella.NIL;
{ StorageSlot slot = null;
Cons iter000 = Stella_Class.clStructSlots(renamed_Class).theConsList;
Cons collect000 = null;
loop000 : for (;!(iter000 == Stella.NIL); iter000 = iter0... |
cdd6a225-94e2-40b6-afed-6332ae501728 | 0 | public UUID getId() {
return this._id;
} |
f17e46e8-23e5-42e1-a20b-b05a95427689 | 1 | public static void main(String[] args){
long result = 0;
for(int i=1;i<=1000;i++){
result = (result+selfP(i))%(10000000000L);
}
System.out.println(result);
} |
e156be74-3d12-42ce-bcf5-c069028124b3 | 0 | private WebDriver getLocalDefaultWebDriver()
{
return registerLocalWebDrivers.getDefaultWebDriver();
} |
eaa68db0-fbf9-4c3b-9b12-b060307982a8 | 5 | private void collectUniversityChanges(CourseModel courseModel,
ArrayList<Change> changes) {
// TODO: is there some API to get university descriptions? They do have
// numeric codes in facets.
for (String u : universities) {
String code = makeIdSafe(u);
if (courseModel.getUniversity(Source.EDX, code) == n... |
e6684620-844c-4bc9-a4aa-5fb2b8ed863b | 4 | public static void main(String[] args) throws IOException {
Settings settings = new Settings();
try {
JCommander JC = new JCommander(settings, args);
} catch (Exception E) {
System.err.println("\n" + E.getMessage());
Usage.printUsage();
Syste... |
8ee05613-714e-471a-b937-adc82b743374 | 4 | private static ObjectType parseObjectType(String sig, Cursor c, boolean dontThrow)
throws BadBytecode
{
int i;
int begin = c.position;
switch (sig.charAt(begin)) {
case 'L' :
return parseClassType2(sig, c, null);
case 'T' :
i = c.indexOf(sig, '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.