method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
000f1be0-e511-48f3-b62f-836e095a8a09 | 1 | public void clear()
{
try
{
prefs.clear();
} catch (Exception e)
{
}
} |
d90cac17-90e7-4b96-8a38-bbfaa71f0850 | 7 | public static float base_score(boolean player, GameState gs) {
if (player) {
int resources = 0;
for (int i = 0; i < gs.getResourceTypes(); i++) {
resources += gs.getResources(i);
}
float score = resources*RESOURCE;
for(Unit u:gs.getMyUnits()) {
score += u... |
81ffcef5-aef7-464d-a412-9c10602d01cf | 5 | public RoomCell(int row, int col, String init) {
super(row, col);
if (init.length()==1){
doorDirection = DoorDirection.NONE;
}else{
room = false;
if(init.charAt(1)=='U'){doorDirection = DoorDirection.UP;
//System.out.println("Door direction is up " + row + " " + col);
} else if(init.charAt(1)=='D')... |
2918794f-23a6-4322-8976-07347e097cfa | 3 | @Test
public void testGetMessageMultipleSubscribers() {
try {
int noOfSubscribers = 2;
final AtomicInteger msgCount = new AtomicInteger(0);
final String message = "TestMessage-testGetMessage_MultipleSubscribers";
final CountDownLatch gate = new CountDownLatch(noOfSubscribers);
final Message expected =... |
6c949ecf-7b0d-4eba-9c98-24e3e208e272 | 9 | public static void main(String[] args) {
String filename = args[0];
String separator = args[1];
In in = new In(filename);
ST<String, Queue<String>> st = new ST<String, Queue<String>>();
ST<String, Queue<String>> ts = new ST<String, Queue<String>>();
while (in.hasNextLi... |
d90a840b-0476-44d7-ab54-fc711c5d4d50 | 7 | private void updateEnemyPositions() {
nextRow = 0;
for(int i = 0; i < enemys.length; i++) {
for(int j = 0; j < enemys[i].length; j++) {
if(!enemys[i][j].isAlive()) {
continue;
}
//Update all positions and if one reaches the bound the variable is set
nextRow |= enemys[i][j].move(ENEMY_MOVEMEN... |
bdb81d56-0676-43a2-b160-3314b045f9b0 | 4 | private void WriteRemoteConf() throws RemoteException{
if(null == localConfPath || "" == localConfPath){
throw new RemoteException("local localConfPath is not correct.please set SetConfpathWithName()");
}
try {
if(!CanCommitFile()){
throw new RemoteException("the remote ... |
c6bb9169-7616-47e0-baf5-fcc0e9628aea | 5 | private void requestBidInfos(TACConnection conn) {
Bid bid;
int bidID;
try {
for (int i = 0; i < NO_AUCTIONS; i++) {
bid = bids[i];
if (bid != null && ((bidID = bid.getID()) != Bid.NO_ID)
&& !quotes[i].isAuctionClosed()) {
TACMessage msg = new TACMessage("bidInfo");
msg.setParameter("bidI... |
82b27411-2fb7-4fce-ab12-e416efeca0bc | 6 | public Row cancelColumn(final int index,
final Row otherrow,
final BigInteger useModulus)
{
// special case: our col[index] is already zero:
if (this.isColumnZero(index))
{
return this;
... |
bd493756-0a97-4b78-9cee-1b14e55d40da | 1 | void enviarJugada(PartidaChip partida, InetAddress ip, int puerto) {
try {
Socket cli = new Socket(ip, puerto);
System.out.println("[]-->Enviando: " + partida.getMensaje() + " a "
+ ip);
ObjectOutputStream flujo_objetos = new ObjectOutputStream(
cli.getOutputStream());
flujo_objetos.writeObjec... |
8f026c94-4098-40b9-957d-0addfc011a00 | 8 | int getSize(){
int size = 8;
if(value != 0)
{
cw.newUTF8("ConstantValue");
size += 8;
}
if((access & Opcodes.ACC_SYNTHETIC) != 0
&& (cw.version & 0xffff) < Opcodes.V1_5)
{
cw.newUTF8("Synthetic");
size += 6;
}
if((access & Opcodes.ACC_DEPRECATED) != 0)
{
cw.newUTF8("Deprecated");
size += 6... |
3192230f-b184-4941-a42f-0d3faa790152 | 2 | @Test
public void testRoomSetConstructorBadInput() {
try {
Room r2 = new Room(null); //null test
fail("IllegalArgumentException was expected");
}
catch (IllegalArgumentException e){
//exception expected
}
try {
Room r2 = new Room(s); //empty set test
fail("IllegalArgumentException was expected... |
e734107e-6104-46ba-8aff-35e740871379 | 9 | void chooseAction(HttpServletRequest request, HttpServletResponse response,
HttpSession session, String query, ActionsController a)
throws ServletException, IOException, SQLException {
switch (request.getParameter("action")) {
case "details":
int postId = Integer.parseInt(request.getParameter("id"));
a... |
410fda11-66f3-4bf3-8eb0-32ff61f7da6e | 0 | public static void main(String args[]){
GenericsType<String> g1 = new GenericsType<String>();
g1.set("Pankaj");
GenericsType<String> g2 = new GenericsType<String>();
g2.set("Pankaj");
GenericsType<Integer> g3 = new GenericsType<Integer>();
g3.set(10);
Generics... |
c6883bd3-5cf4-42c8-88a1-fbddfd64ab99 | 0 | @Override
protected void setColoredExes() {
ParametricCurve ermit = new ErmitCurve(allex);
coloredEx = ermit.Calculation();
} |
ece857ee-405d-4019-bbd1-ca8d9ee12414 | 2 | public void link() {
synchronized (ui) {
if (parent.lchild != null)
parent.lchild.next = this;
if (parent.child == null)
parent.child = this;
this.prev = parent.lchild;
parent.lchild = this;
}
} |
1b1f747e-ff5d-4b84-8720-290fcf008577 | 0 | public int getAnturium() {
return anturium;
} |
5a3ad717-1b3f-4d36-90a5-833af3ba1408 | 2 | public String cd(String to) {
String name = FilenameUtils.concat(currentDirectory, to);
File file = new File(name);
if (file.exists() && file.isDirectory()) {
currentDirectory = name;
log.warn(name);
return null;
}
return "Directory not found";... |
63b9f3f8-115f-4d6b-a705-fdad8ccd3253 | 7 | public static void setupRace(int raceID) {
Player player = new Player();
switch (raceID) {
case 1:
player.setRace(RaceTypes.GOBLIN);
break;
case 2:
player.setRace(RaceTypes.ELF);
break;
case 3:
player.setRace(RaceTypes.DWARF);
break;
case 4:
player.setRace(RaceTypes.HUMAN);
bre... |
47e52a17-874d-4a5e-9ac4-84aff6cb15ab | 6 | public static HashMap<String, MetadataTSVParser> getMap() throws Exception
{
HashMap<String, MetadataTSVParser> map = new LinkedHashMap<String, MetadataTSVParser>();
BufferedReader reader = new BufferedReader(new FileReader(new File(ConfigReader.getMbqcDir() +
File.separator + "metadata" + File.separator +... |
5fd76706-5e8f-4c77-883a-8db105ded185 | 1 | private void calcSize()
{
this.getSize().setWidth(this.ItemSize.getWidth() * this.DisplayItems);
this.getSize().setHeight(this.ItemSize.getHeight());
this.Matrix.clear();
for(int x = 0; x < this.DisplayItems; x++)
{
Rectangle rect = new Rectangle(x * this.getItem... |
e17bfeed-3165-4355-82d1-c7e8965e0cf1 | 0 | public TerritoryAi(GoAiGame game1)
{
game = game1;
squares = new HashSet<Square>();
} |
584d9c85-fa94-49f4-a65a-22bdf595544d | 0 | @Test
public void testCheckValidWorld() throws Exception {
System.out.println("checkValidWorld");
World instance = new World();
instance.readInWorld("1.world");
boolean expResult = true;
boolean result = instance.checkValidWorld();
assertEquals(expResult, result);
... |
5b6adbf4-6ab3-419d-9960-ca843e0f9941 | 6 | @Test
public void boardSize8KingAndRook() {
Map<String, Integer> figureQuantityMap = new HashMap<>();
figureQuantityMap.put(KING.toString(), 2);
figureQuantityMap.put(ROOK.toString(), 2);
int dimension = 8;
assertThat("all elements are not present on each board",
... |
8e9826b6-b5cf-4108-a402-33c974279136 | 1 | public JsonMap getMap(String key) {
Object value = get(key);
if (value instanceof JsonMap) {
return (JsonMap) value;
}
return new JsonMap();
} |
098e5aba-087e-4f5f-bccc-7b7878203941 | 6 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (args.length == 1 && args[0].equalsIgnoreCase("help")) {
showHelp(sender);
return true;
}
if (args.length == 1 && args[0].equalsIgnoreCase("list")) ... |
abb26952-4667-4c8e-8d6a-d9143aec7ecb | 3 | private void removeDeadParticles() {
for (int particleIndex = 0; particleIndex < particleArray.length; particleIndex++) {
if (particleArray[particleIndex] != null) {
if (particleArray[particleIndex].isParticleAlive() == false) {
particleArray[particleIndex] = null... |
0e02abef-7dde-4319-985b-221be4b1837d | 9 | @Override
protected void placeWord(int row, int col) throws FillWordException {
if (row < 0 && col < 0 && swaps < swapLimit
&& (-row > board.length)) {
// Swap the word and deduct the points.
System.out.println("Grow board, discard word " + wordToPlay
... |
db114c9a-67b8-414b-b721-2746393e2d56 | 3 | private static boolean validateBinaryInput(String input) {
int n = input.length();
for (int i = 0; i < n; i++)
if (input.charAt(i) != '0' && input.charAt(i) != '1')
return false;
return true;
} |
fc13fbc3-a5b6-4580-8eba-fe858c9a0020 | 3 | public Slot getCellContaining(GUIComponent component) {
for (int r = 0; r < grid.getNumRows(); r++) {
for (int c = 0; c < grid.getNumColumns(); c++) {
if (cells[r][c].getComponent() == component) {
return cells[r][c];
}
}
}
... |
5a9c9c72-9240-47e5-a8ae-67c41fd45f2a | 4 | public Color getColor() {
Color returnColor = new Color(255, 255, 255);
switch (this) {
case RED:
returnColor = Color.RED;
break;
case YELLOW:
returnColor = Color.YELLOW;
break;
case GREEN:
returnColor = Color.GREEN;
break;
case BLUE:
returnColor = Color.BLUE;
break;
d... |
56f798f9-24c6-4b44-b941-9bd0e882fa7a | 4 | public List<T> mapRersultSetToObject(ResultSet rset) throws SQLException, NoSuchColumnLabel {
List<T> output = new ArrayList<T>();
ResultSetMetaData rsmd = rset.getMetaData();
try {
while(rset.next()){
T bean;
bean = clazz.newInstance();
for( int i=rsmd.getColumnCount(); i >= 1; i-... |
52f40abb-34e1-475b-a580-fbda5ea8bc8c | 1 | @Override
public void mouseMove(MouseEvent e) {
if(this.getMouseListener() != null)
{
this.getMouseListener().MouseMove(this, e);
}
} |
9078b7d1-2ada-46ba-b117-448eaf11a90d | 3 | @Override
public void run(){
try{
System.out.println("HireWorkerServer is waiting for new workers on the port: "+this.portNum);
while(running){
Socket workerSocket = serverSocket.accept();
System.out.println("worker: "+workerSocket.getInetAddress()+":... |
562649aa-d524-482b-93c1-79ab18c714a0 | 6 | private void optFormat(final CommandLine cmd) {
if (cmd.hasOption(OPT_FORMAT)) {
final String formatOption = cmd.getOptionValue(OPT_FORMAT);
if ("tree".equalsIgnoreCase(formatOption)) {
options.setOutputFormat(OutputFormat.TREE);
} else if ("xml".equalsIgnore... |
efb86ad8-4f9e-4a8e-8e79-3d450d36a805 | 5 | private static void drawSink(Display d)
{
int max = 10;
int max_iter = 50;
/* Complex t = new Complex(0,0);
Color current = new Color(d,0,0,0);*/
int X = WIDTH/2;
int Y = HEIGHT/2;
for (int y = -Y; y < Y; ++y)
{
for (int x = -X; x < X; ++x)
{
Complex z = new Complex (x*0.005,y*0.005);
Com... |
7f7106d0-b2b1-4d4e-9317-a66f947bd231 | 2 | public double getDouble(String key) throws JSONException {
Object object = this.get(key);
try {
return object instanceof Number ? ((Number) object).doubleValue()
: Double.parseDouble((String) object);
} catch (Exception e) {
throw new JSONException("JS... |
85defea0-4419-4983-965f-d4b8597a2cdb | 7 | protected double[] freqCountsForAggNodesStrategy(double[] instance,
Attribute classAtt) throws Exception {
double[] counts = new double[classAtt.numValues()];
if (m_childNodes.size() > 0) {
// collect the counts
for (TreeNode c : m_childNodes) {
if (c.getPredica... |
3f7db187-b40a-430e-8a6f-b0f669af262e | 0 | public DisponibleAreas() {
setIconImage(Toolkit.getDefaultToolkit().getImage(DisponibleAreas.class.getResource("/InterfazGrafica/Images/areas.png")));
setTitle("\u00C1REAS DISPONIBLES");
setBounds(10, 50, 623, 741);
setLocationRelativeTo(null);
setModal(true);
getContentPane().setLayout(new BorderLayout());... |
761bcae7-1b30-4c99-82c5-8cba1520b57d | 2 | public static Double getDouble(Object obj){
if(obj == null) return null;
try {
Double i = Double.parseDouble(obj.toString());
return i;
}
catch(Exception e){
return null;
}
} |
d41e0c68-7084-4a04-b61f-b106f2d3d664 | 2 | private List<Command> getMatchingCommands(String arg) {
List<Command> result = new ArrayList<Command>();
for (Entry<String, Command> entry : commands.entrySet()) {
if (arg.matches(entry.getKey())) {
result.add(entry.getValue());
}
}
return... |
b4d36642-9479-4ec0-adb5-1e6bd3cfbea1 | 4 | @Override public int hashCode() {
int result;
long temp;
result = hitPoints;
result = 31 * result + pixelSpeed;
result = 31 * result + dmgToBase;
result = 31 * result + gold;
result = 31 * result + (alive ? 1 : 0);
result = 31 * result + (active ? 1 : 0);
result = 31 * result + (board != null ? board.hashCode(... |
9113d711-0aa9-4995-bcdd-787bebcf1b23 | 0 | @Override
public int compare(Fetcher f1, Fetcher f2) {
return f1.getRequestWrapper().getPriority()
- f2.getRequestWrapper().getPriority();
} |
25fad206-7f5c-4038-b6fe-bf4a95645a8f | 3 | public Configuration loadEmbeddedConfig(final String resource) {
final YamlConfiguration config = new YamlConfiguration();
final InputStream defaults = this.getResource(resource);
if (defaults == null) return config;
final InputStreamReader reader = new InputStreamReader(defaults, Custo... |
728bb363-4c37-4352-b944-bc02f9aa0655 | 6 | public void createCustomer(String name, String address, String postnr,
String by, String email, String nr)
{
if (name != null && address != null && postnr != null && by != null
&& email != null && nr != null)
{
Customer c = new Customer(name, address, postnr, ... |
a0f4c21c-727b-4124-9bfc-0ed11cee66c9 | 7 | public static boolean extractFile(File zip, File output, String fileName) throws IOException, InterruptedException {
if (!zip.exists() || fileName == null) {
return false;
}
ZipFile zipFile = null;
try {
zipFile = new ZipFile(zip);
ZipEntry entry = z... |
ac389b5f-d2e8-4a16-99b8-c2562c4fed14 | 6 | boolean anyResultMatches(String transcriptId, Variant seqChange, List<ChangeEffect> resultsList, boolean useSimple, StringBuilder resultsSoFar) {
boolean ok = false;
for (ChangeEffect chEff : resultsList) {
String resStr = chEff.toStringSimple(!useSimple);
if (verbose) System.out.println(seqChange + "\t'" + r... |
e8458197-5b38-4914-a0e7-64ae9332fcd7 | 4 | private void parseArguments(String[] args)
{
if (args.length > 0)
{
config.set("username", args[0]);
if (args.length > 1)
{
config.set("password", args[1]);
if (args.length > 2)
{
String ip = args... |
daf0ebe1-b740-4749-931e-9f1a53ce3b23 | 2 | @Override
public List<Vehicule> getVehicules() throws BadResponseException {
List<Vehicule> vehicules = new ArrayList<Vehicule>();
JsonRepresentation representation = null;
// R�cup�ration de la liste des Vehicules
Representation repr = serv.getResource("intervention/" + interId
+ "/vehicule", null);
... |
94e3ec4e-6f9a-4fcf-949d-c51c69d5375f | 2 | private int checkBeatOutOfBounds(){
if (beat.getBounds().contains(0, BEAT_START_Y)){
return 0;
}
if (beat.getBounds().contains(WIDTH, BEAT_START_Y)){
return 1;
}
return 2;
} |
7d0abd54-ddce-48f7-8629-fc60942b3a5d | 1 | public void setPanel(AnalysePanel panelCurrent) {
if (this.panelCurrent != null)
center.remove(this.panelCurrent);
center.add(BorderLayout.CENTER, panelCurrent);
center.revalidate();
center.repaint();
this.panelCurrent = panelCurrent;
} |
90059b48-9dfd-4880-b64f-2c2275ef1021 | 8 | public void compExecTime() {
double newExeTime;
double newCost;
dEval = 0;
dTime = 0;
dCost = 0;
for (int i = 0; i < iClass; i++) {
newExeTime = 0;
// System.out.print("Cost[" + i + "]");
for (int j = 0; j < iSite; j++) {
if (dmAlloc[i][j] != -1) {
if (dmAlloc[i][j] < 1) {
newExeTime... |
b658e2f7-9d1d-41d9-a08a-0c3672add400 | 6 | @Override
public boolean execute(final CommandSender sender, final String[] split) {
if (sender instanceof Player) {
if (MonsterIRC.getHandleManager().getPermissionsHandler() != null) {
if (!MonsterIRC.getHandleManager().getPermissionsHandler()
.hasCommand... |
eea22727-5b2a-47bc-b9da-1d047615741b | 1 | public void visitLabelStmt(final LabelStmt stmt) {
if (stmt.label() != null) {
println(stmt.label());
}
} |
37a6b72c-8144-46ca-8e53-3dcf1bb0164e | 7 | private Location findTarget()
{
Field field = getField();
List<Location> adjacent = field.adjacentLocations(getLocation());
Iterator<Location> it = adjacent.iterator();
while(it.hasNext()) {
Location where = it.next();
Object animal = field.getObjectAt(where);... |
955dfaf0-b031-416d-ae7d-050099c7d04f | 0 | public PosController() {
} |
6227a799-fbf6-4390-8f91-432742f88756 | 3 | private ArrayList<String> getWordsFromFile(String fileName) {
ArrayList<String> wordsList = new ArrayList<String>();
try {
BufferedReader rd = new BufferedReader(new FileReader(fileName));
while (true) {
String line = rd.readLine();
if (line == null) {
break;
}
wordsList.add(line... |
56a0f452-0321-45ba-93d8-30813a19f953 | 9 | private boolean checkSelf() {
boolean isValid = true;
if (parent != null) {
if (!parent.isExistentInCli() && isExistentInCli()) {
selfErrorMessage +="Option " + getName() + " not allowed, "
+ "if option " + parent.getName() + " not present. ";
... |
ef1c0e34-d917-4adc-ac13-eac88c19a710 | 9 | @Override
protected void layoutPlotChildren() {
if (getData() == null) {
return;
}
for (int seriesIndex = 0; seriesIndex < getData().size(); seriesIndex++) {
XYChart.Series<Number, Number> series = getData().get(seriesIndex);
I... |
7223a024-5adc-4a88-8627-e96cfdcd9c2c | 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 Medicamentos)) {
return false;
}
Medicamentos other = (Medicamentos) object;
if ((this.idmedicamentos == null &... |
439de813-e636-4f40-abf4-ad3eed226a06 | 5 | public void doDamage(LivingThing oo) {
double hpDamage;
double strengthDamage;
double intelligenceDamage;
double dexterityDamage;
double speedDamage;
double manaDamage;
double baseXpDamage;
double remainingHp;
double remainingStrength;
double remainingIntelligence;
double remainingDexterity;
dou... |
a93b2bad-cd74-40a3-9037-6be8905ea191 | 7 | public static void main (String args[]) {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e0) {
try {
UIMan... |
589ddfe7-c9b0-46c1-a6d7-901f80d4ee6f | 7 | @Override
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
super.update(container, game, delta);
if (alive) {
if (World.tickCount % 30 == 0) {
energyTick();
}
if (energy <= 0 ... |
e970020b-b89c-455b-8990-1b50dba92cad | 4 | public Object getValueAt(int row, int col) {
if(null == data)
return null;
if(col>=columnNames.length || col<0 || row<0)
return null;
return data[row][col];
} |
beca37f8-6fd6-4716-a0aa-0a1276eccd65 | 5 | public boolean intersectCube(double minX, double minY, double minZ,
double maxX, double maxY, double maxZ) {
return this.minX < maxX && this.maxX > minX && this.minY < maxY
&& this.maxY > minY && this.minZ < maxZ && this.maxZ > minZ;
} |
b3249096-d7c6-4f7b-878c-3ee24555e77f | 8 | private void parseConfLine(SBConfig conf, String str) {
// Parse the config line.
String delim = "[ ]";
String [] tokens = str.split(delim);
List<String> list = new ArrayList<String>();
for(String s : tokens) {
if(s != null && s.length() > 0) {
list.add(s);
}
}
... |
74a35783-0a40-40b6-8b3c-da7ac0d7524d | 9 | private static Class<?> findMainClass(Iterable<Class<?>> classes)
{
// find a public class with public static main method
for (Class<?> clazz : classes)
{
int modifiers = clazz.getModifiers();
if (Modifier.isPublic(modifiers))
{
Method mainMethod = findMainMethod(clazz);
if (mainMethod != null)
... |
1089899c-61c4-45dd-ae8c-4fc5f8229948 | 1 | public static HttpServletRequest listPatients(HttpServletRequest request) {
Models.DatabaseModel.Patient patient = new Models.DatabaseModel.Patient();
ArrayList<Models.DatabaseModel.Patient> patients = patient.listAllPatients();
for (Models.DatabaseModel.Patient thisPatient : patients) {
... |
f247b3e6-5d35-4ce1-973b-5fcfab2f183b | 4 | public Team getTeam(){
if(this == RED) return Team.RED;
else if(this == BLUE) return Team.BLUE;
else if(this == NOTCHOSEN) return null;
else{
Random r = new Random();
if(r.nextBoolean()) return Team.RED;
return Team.BLUE;
}
} |
f9fbb1fa-2193-4dc1-abdb-66681f880222 | 2 | public String getCitedIDList(int queryid) {
String idList = "";
String query = "select distinct citationid from dblpcitation where indexid="
+ queryid + " order by citationid asc";
ResultSet rsSet = null;
rsSet = sqLconnection.Query(query);
try {
while (rsSet.next()) {
int id = rsSet.getInt("citati... |
1fbc3f58-59a7-48d3-969d-49acd2d330c2 | 6 | protected CtClass createCtClass(String classname, boolean useCache) {
// accept "[L<class name>;" as a class name.
if (classname.charAt(0) == '[')
classname = Descriptor.toClassName(classname);
if (classname.endsWith("[]")) {
String base = classname.substring(0, classna... |
61213e1b-b99e-4b59-8a95-7a237744a64d | 6 | @Override
public void run() {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
out.println("Ingrese operacion (SUMAR, RESTAR, MULTIPLICAR, DIVIDIR)");
... |
e5660b3e-efe9-46f4-af84-b4db0787fa2f | 8 | @Override
public int compareTo (@SuppressWarnings("NullableProblems") JavaInfo o) {
if (o.major > major)
return -1;
if (o.major < major)
return 1;
if (o.minor > minor)
return -1;
if (o.minor < minor)
return 1;
if (o.revision > r... |
f7b5d19a-ccb4-4018-a51e-6d28f211fe2a | 6 | public List<List<Integer>> levelOrderBottom(TreeNode root) {
if (root == null)
return new ArrayList<>();
Queue<TreeNode> queue = new LinkedList<>();
Stack<ArrayList<Integer>> finalStack = new Stack<>();
queue.add(root);
int last = 1;
int current = 0;
... |
cd61fa70-d599-481b-84d0-9e729f310c3e | 0 | @Override
@RequestMapping(value = "/beers/{id}", method = RequestMethod.DELETE)
@ResponseBody
@Transactional
public BeerResponse delete(@PathVariable("id") Long id) {
Beer beer = persistenceService.delete(Beer.class, id);
return BeerResponse.createBeerResponse(beer);
} |
77f2aa8a-ba61-472f-8e47-ed2d4d2aedb5 | 5 | @Override
public void keyReleased(KeyEvent e)
{
//The code of the released Key
int key = e.getKeyCode();
//The direction
Direction direction = null;
//We check each keycode and relate a direction to it
if(key == e.VK_UP)
... |
ba2db9e8-7b95-40a0-8ac1-8b7c10d04a1c | 7 | private TreeSet<Connectable> recursiveDFS(Connectable damOrRiver, TreeSet<Connectable> completedIndexs, TreeSet<Connectable> tmpList){
if(completedIndexs.contains(damOrRiver)){
if(tmpList != null)
completedIndexs.addAll(tmpList);
return completedIndexs; // If it has already been solved, stop
}
if(damOrR... |
5d35e62f-4529-42d4-a611-fcd85863122f | 4 | public double messageNode2Factor(int factor, int node, int value) {
double result = 1.0;
result *= messageFactor2Node(node, node, value);
if (factor == potentials.chainLength() + node && factor > potentials.chainLength() + 1) {
// right factor f' -> n -> f && this is not the second node
result *= messag... |
9025c1f1-f21b-48f5-be27-98be0573dc2a | 1 | public void changedServerPswd(boolean psw_set){
togglePassword(psw_set);
if(psw_set){
// When password is first loaded set fake text
serv_pswd.setText("fake");
passChanged=false;
} else {
serv_pswd.setText("");
}
} |
5f26942d-f90b-44d3-82a9-054fb1ace095 | 8 | public double getProportion(String oldUnit, String newUnit)
{
double result = 0;
double numerador = 0;
double denominador = 1;
if(oldUnit.equalsIgnoreCase("Hours"))
{
numerador = 1;
}
else if(oldUnit.equalsIgnoreCase("Days"))
{
numerador = 24;
}
else if(oldUnit.equalsIgnoreCase("Months"))
... |
9b2c54ac-72c4-4042-ae49-bc0d4d74cf1b | 7 | private void packtiles(Collection<Tile> tiles, Coord tsz) {
int min = -1, minw = -1, minh = -1;
int nt = tiles.size();
for (int i = 1; i <= nt; i++) {
int w = Tex.nextp2(tsz.x * i);
int h;
if ((nt % i) == 0)
h = nt /... |
9010917b-2177-4595-9fa5-70b0f204acd1 | 0 | public void setCode(String code) {
this.code = code;
} |
a21258f0-5016-4ec2-9993-bd01ba458c81 | 7 | private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) {
int rounds, i, j;
int cdata[] = (int[])bf_crypt_ciphertext.clone();
int clen = cdata.length;
byte ret[];
if (log_rounds < 4 || log_rounds > 31)
throw new IllegalArgumentException ("Bad number of rounds");
rounds = 1 << log_rounds;
... |
3336ffb2-a39b-4a66-ad02-564bf8573791 | 8 | public boolean handleMaterialAcceleration(AxisAlignedBB par1AxisAlignedBB, Material par2Material, Entity par3Entity)
{
int var4 = MathHelper.floor_double(par1AxisAlignedBB.minX);
int var5 = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D);
int var6 = MathHelper.floor_double(par1AxisAli... |
6020c827-dd20-424f-b7c0-9b0555ba2c74 | 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 CleasingTagsHtml)) {
return false;
}
CleasingTagsHtml other = (CleasingTagsHtml) object;
if ((this.id == null &... |
7ae78a79-8804-43e4-9737-9822138749d3 | 7 | private ParsedExpression parseShell(String shell) {
Assert.notNull(shell, "Shell must not be null");
Set<String> namedParameters = new HashSet<String>();
ParsedExpression parsedShell = new ParsedExpression(shell);
char[] shellChars = shell.toCharArray();
int namedParameterCount = 0;
// int unnamedParamete... |
0291afaa-d733-4aaa-bf91-310e6e61bd40 | 9 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == display) {
} else if (e.getSource() == ok) {
this.setVisible(false);
this.dispose();
} else if (e.getSource() == resize) {
gridPanel.initFonts();
chineseExample.setFont(gridPanel.get... |
3399cb91-ff40-48a0-8144-40d24a701018 | 2 | private float blockWeight(final Block block) {
int depth = cfg.loopDepth(block);
if (depth > RegisterAllocator.MAX_DEPTH) {
return RegisterAllocator.MAX_WEIGHT;
}
float w = 1.0F;
while (depth-- > 0) {
w *= RegisterAllocator.LOOP_FACTOR;
}
return w;
} |
7a7bfe31-a6a8-4efb-8c92-b826ac0718fc | 3 | private KmeansLogger()
throws LogException {
KmeansLogger.log= Logger.getLogger(KmeansLogger.class.getName());
FileHandler fh= null;
try {
fh = new FileHandler("LogKmeans " + new Date().toString());
KmeansLogger.log.addHandler(fh);
KmeansLogger.log.setUseParentHandlers(false);
} catch... |
0a9e63a3-7c5a-473f-a588-7932e018601c | 4 | private void drawMenu() {
if (interfaceNumber == 0) {
bufferGraphics.drawImage(imageMap.get("missionBackground"), 0, 0, this);
drawButtonsFromList(pathwayMissionButtons);
} else if (interfaceNumber == 11) {
bufferGraphics.drawImage(imageMap.get("chooseBackground"), 0, 0, this);
drawButtonsFromList(choos... |
d3e7ae6e-d89a-4119-8523-77a3794b812b | 8 | public void update()
{
if (!blnLoaded)
{
return;
}
int x,
y,
i,
i2;
x=0;
y=0;
for (i=0; i<=numMapImages; i++)
{
gD_p.drawImage(imgMapPalette,
x*intImageSizePalette,y*intImageSizePalette,
(x+1)*intImageSizePalette,(y+1)*intImageSizePalette,
i*intImageSizePalette,0,
... |
2802f3fe-153e-4147-8ef6-faf9079a8f28 | 1 | protected Integer calcBPB_ReservedSecCnt() throws UnsupportedEncodingException {
byte[] bTemp = new byte[2];
for (int i = 14;i < 16; i++) {
bTemp[i-14] = imageBytes[i];
}
BPB_ReservedSecCnt = byteArrayToInt(bTemp);
System.out.println("Количество секторов в Reserved re... |
b29a69d0-4ad9-43fa-8370-de68a1953ccc | 7 | private boolean selectCommitMethod(Object obj,int reservID,int src,int tag)
{
boolean flag = true;
try
{
// A case where a reservation only has 1 Gridlet
Gridlet gridlet = (Gridlet) obj;
if (checkGridlet(gridlet))
{
( (ARPolicy)... |
b8d30663-2c02-4e16-b83c-23c959f182e3 | 0 | public String getDateEmbauche() {
return dateEmbauche;
} |
ca80ca87-c084-4342-9583-abdbba891fe5 | 1 | @EventHandler
public void Nicks(AsyncPlayerChatEvent e) {
Player p = e.getPlayer();
String name = p.getName();
String nick = NicknamesConfig.getNicknames().getString(name);
// To avoid an NPE being thrown
if(nick != null) p.setDisplayName(nick + ChatColor.RESET);
} |
d546dd8b-8121-4a5f-9f9d-c61b6167745a | 7 | private void drawSolutionProgress(Graphics2D g2)
{
if (numSolutions == 0)
{
return;
}
//System.err.println("---- " + currentHelp1Counter + " / " + numSolutions);
if (HelpParadigm.Classic.equals(slateComponent.getSlateSettings().getHelpParadigm()))
{
// Draw circular progress of number of soluti... |
95725381-d021-439d-8da6-942f0036ddd2 | 0 | public void setName(String name) {
this.name = name;
} |
cabbc3f9-ecd0-473b-be40-4008a70a4506 | 5 | public SubgroupPanel() {
super();
setCellRenderer(new SymmetryListCellRenderer());
setSelectionBackground(SymmetryChooser.SelectionBackground);
setBackground(Color.WHITE);
addListSelectionListener(new ListSelectionListener() {
@SuppressWarnings("unchecked")
@Override
public voi... |
daf3dda6-95d6-47bb-ab51-4c3634a5e610 | 8 | public void enterLoop() {
_mainFrame.dispose();
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
while(true) {
try {
if(r.ready()) {
String s = r.readLine();
if(s.equals("exit")) {
_server.kill();
System.out.println("Good Bye");
System.exit(0);
} els... |
df032039-f2dc-4a03-939c-5b0b98322dc0 | 3 | private String safe (String src) {
StringBuffer sb = new StringBuffer ();
for (int i = 0; i < src.length (); i++) {
char c = src.charAt (i);
if (c >= 32 && c < 128) {
sb.append (c);
} else {
sb.append ("<" + (int) c + ">");
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.