method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7705643f-9043-40a5-8fc8-1baac4f18eed | 9 | @Override
public void setComponents() {
this.lblParam1.setVisible(false);
this.lblParam2.setVisible(false);
this.txtParam1.setVisible(false);
this.txtParam2.setVisible(false);
this.calFecha1.setVisible(false);
this.calFecha2.setVisible(false);
this.lblEMaxProm... |
609cc2d8-4792-4da5-b950-35e510a1dd4c | 8 | private void beforeValue(boolean root) throws IOException {
switch(peek()){
case NONEMPTY_DOCUMENT:
if (!lenient){
throw new IllegalStateException("JSON must have only one top-level value");
}
case EMPTY_DOCUMENT:
if (!lenient && !root){
throw new IllegalStateException("JSON must start with an a... |
e4829271-74f0-4b52-9c5e-52104d508ea9 | 1 | private void calculateSpeed(){
this.information.setSpeed(this.information.getSpeed() - this.information.getSpeedReduction());
if(this.information.getSpeed() < 0.0){
this.information.setSpeed(0.0);
}
} |
3d8f3d6f-1149-468b-b8cc-65b5242fcf39 | 1 | public int getCount(ArrayList<FilterBean> hmFilter) throws Exception {
int pages;
try {
oMysql.conexion(enumTipoConexion);
pages = oMysql.getCount("alumno", hmFilter);
oMysql.desconexion();
return pages;
} catch (Exception e) {
throw ne... |
785d3558-da62-4163-af1f-b99103492b96 | 7 | @Override
public void add(T t) {
LockFreeNode<T> newNode=new LockFreeNode<T>(t,false);//new leaf
SearchReturnValues ret;
while(true){
ret=search(newNode);
if(newNode.compareTo(ret.l)==0)
return;
if(!ret.si.isClean()){
Help(ret.si);
}else{
T key=(newNode.compareTo(ret.l)<0)?ret.l.value:ne... |
ad9c7566-9ea7-41e5-9b06-23a04252b694 | 0 | public Main() {
} |
34003640-f818-46e5-8745-b2e39503508b | 3 | public void moveWithinFrame(Rectangle2D bounds) {
Object[] vertices = vertices();
if (vertices.length == 0)
return;
Point2D p = pointForVertex(vertices[0]);
double minx = p.getX(), miny = p.getY(), maxx = minx, maxy = miny;
for (int i = 1; i < vertices.length; i++) {
p = pointForVertex(vertices[i]);
... |
b0ae55b6-a0db-4cea-a9d5-123a11004eb8 | 2 | public static Point2D.Double randomPointInCircle(double radius, Point2D.Double origin, double theta, double offset) {
Random randomGen = new Random();
if (origin == null) {
origin = new Point2D.Double();
}
double u = (randomGen.nextDouble() * radius) + (rand... |
caf4d19a-e3a0-44db-ab3a-1e9ac4d97d3f | 6 | public static double shortestDistance(String filename, double x, double y) {
double x1 = 0;
double y1 = 0;
double shortest = Double.MAX_VALUE;
String regex = "[0-9]+\\.*[0-9]*";
Pattern pattern = Pattern.compile(regex);
try {
BufferedReader br = new BufferedReader(new FileReader(filename));
Stri... |
8670266b-ec6b-4eb6-a844-ab958e92bb9e | 6 | private void readTextInput (String fileName) {
try {
Entry newEntry;
FileReader fin = new FileReader(fileName);
BufferedReader br = new BufferedReader(fin);
String currentLine = br.readLine();
String entryText = "", entryDate ... |
c81beb9a-4b36-48bd-92eb-9cb45a585bfc | 8 | public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.translate(offset, offset);
Font font = new Font("Monospaced", Font.BOLD, 30);
g2.setFont(font);
g2.drawString(frame.getSelectedTool().toString(), 600, -10);
// grid
g2.setStroke(new BasicStroke(1));
... |
0f8aee66-813f-4e72-a348-95547f60e4bb | 3 | public void keepItem1() {
for(int i = 0; i < playerItems.length; i++) {
int highest = 0;
int value = (int)Math.floor(GetItemShopValue(playerItems[i]-1, 0, i));
if(value > highest && playerItems[i]-1 != -1) {
highest = value;
keepItem = playerItems[i]-1;
keepItemAmount = playerItemsN[i];
}
}
} |
a298f7f2-a516-4e16-b8ad-34591b7a50f5 | 5 | public static void main(String[] args) {
System.out.println("It works.");
System.out.println(System.getProperty("user.dir"));
try {
System.out.println(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException e) {
e.printStackTrace();
}
... |
2a4c5043-8149-4428-8c7f-1d9f3495fc2a | 8 | public void acceptClusterer(BatchClustererEvent ce) {
if (ce.getTestSet() == null ||
ce.getTestOrTrain() == BatchClustererEvent.TEST ||
ce.getTestSet().isStructureOnly()) {
return;
}
Instances trainHeader = new Instances(ce.getTestSet().getDataSet(), 0);
String titleString = ce.g... |
bbbf16fc-7d11-4dae-8d9a-e8f58ba43bc7 | 1 | public void setAdmin()
{
if (this.name == "admin")
{ this.admin = true; }
else { this.admin = false;}
} |
a33a552b-e592-43ac-9caa-12c83037bc45 | 3 | public void run() {
System.out.println(LoadBalancer.getCurrentTime() + "::" +"Starting Status checker thread");
serverInfo server;
String status;
while(true) {
try {
//System.out.println("StatusChecker: Before Acquire");
ConnectionTable.serverListLock.acquire();
//System.out.println("StatusCheck... |
119ea9ba-25c7-4ca1-bb41-064cd3195b4c | 2 | public static String deleteZero(String value) {
String[] strings = value.split("\\.");
if (strings.length > 1 && Integer.parseInt(strings[1]) == 0) {
return strings[0];
}
return value;
} |
3ecc9d31-6b38-4081-a1af-cbaeb3d1f026 | 8 | public static void main(String[] args) throws IOException {
int[][] grid = getGrid();
int maxProduct = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (j + 4 < N)
maxProduct = Math.max(maxProduct, grid[i][j] * grid[i][j + 1] * gri... |
a997e5c8-e029-4421-9af3-524eb658f1db | 1 | public void setDistance(int k) {
if (k == 0)
this.distance = new ChebyshevDistance();
else
this.distance = new MinkowskiDistance(k);
} |
33f5ae20-8ca8-4b3f-a66a-b6e2c24bd7c4 | 4 | public static void loadlist(InputStream list, int prio) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(list,
"us-ascii"));
String ln;
while ((ln = in.readLine()) != null) {
int pos = ln.indexOf(':');
if (pos < 0)
continue;
String nm = ln.substring(0, pos);
in... |
dcd7e8af-8c98-4e0f-971c-6bda9906ca8e | 0 | public String getName() {
return name;
} |
8d3213da-dde2-4267-91bf-96d012c4baf9 | 2 | public void update(){
Graphics2D g = (Graphics2D)getBufferStrategy().getDrawGraphics();
//Clear screen
g.setColor(Color.BLACK);
g.fillRect(0, 0, getWidth(), getHeight());
if (inMainMenu)
paintMainMenu(g);
else{
paintItems(g);
if (paused)
paintPauseScreen(g);
}
getBufferStrat... |
ac7648fd-7d50-44d2-9f80-950e4488a125 | 1 | private boolean jj_3_12() {
if (jj_3R_30()) return true;
return false;
} |
a3464764-8332-4afe-b235-92be7e33fedb | 6 | public static double asin(double x) {
if (x != x) {
return Double.NaN;
}
if (x > 1.0 || x < -1.0) {
return Double.NaN;
}
if (x == 1.0) {
return Math.PI / 2.0;
}
if (x == -1.0) {
return -Math.PI / 2.0;
}
if (x == 0.0) { // Matches +/- 0.0; return correct sign
return x;
}
/* Comp... |
973af867-5003-4e9a-aaeb-25a307449dcf | 2 | @Override
public void run() {
long prevTime = 0;
while (true) {
//repaint at 60fps
if (System.currentTimeMillis() - prevTime > 17) { //1000 / 60 = 16.6, rounded up to 17 ms delay
panel.repaint();
prevTime = System.c... |
1170f3d5-9852-4592-8ef9-a2d64a9996f5 | 9 | public String longestPalindrome(String s) {
if (s == null || s.length() == 0){
return null;
}
int[][] dp = new int[s.length()][s.length()];
dp[0][0] = 1;
int max = 1;
String maxString = s.substring(0, 1);
char pre = s.charAt(0);
for (int i = 1; i < s.length(); i++) {
dp[i][i] = 1;
if (s.charAt(... |
2f799ca7-5889-45a2-81ba-28d74c600a90 | 2 | private void testExistingField(String name, String descriptor)
throws DuplicateMemberException {
ListIterator it = fields.listIterator(0);
while (it.hasNext()) {
FieldInfo minfo = (FieldInfo)it.next();
if (minfo.getName().equals(name))
throw new Duplic... |
80ccacac-5c13-4db9-bd6a-7e62fc06ec95 | 0 | @Column(name = "CUE_MOVTO")
@Id
public String getCueMovto() {
return cueMovto;
} |
f1d73e67-302d-4bce-ab2c-a6e76d110b21 | 7 | private void updateLabels() {
pacmanScoreLabel.setText("Score: " + pacmanScore);
pacmanLivesLabel.setText(SPACE + "Lives: " + pacmanLives + " ");
final int timeToRelease = (int) GHOST_RELEASE - (int) ((System.currentTimeMillis() - ghostReleasedAt) / 1000);
if (ghostPenQ.size() >= 0 && timeToRel... |
a5ed24cb-16d7-4b88-a439-9d5a7ad045a8 | 2 | public Image getNextTile() {
if (nextY + tileHeight + tileMargin <= image.getHeight()) {
BufferedImage tile =
image.getSubimage(nextX, nextY, tileWidth, tileHeight);
nextX += tileWidth + tileSpacing;
if (nextX + tileWidth + tileMargin > image.getWidth()) {
... |
e4729770-0637-4343-a11d-d3b768788f24 | 1 | protected boolean canChange(int value){
Controller c = gui.getController();
if (centerCause(value, c.getX2(), c.getY1(), c.getY2(), c.getR1(), c.getR2())){
return true;
}
else{
showCenterWarning();
return false;
}
} |
3c9e6264-3fc8-4984-99c4-f1acc5cf2903 | 4 | public int maxDepth(TreeNode root) {
if(root == null){
return 0;
}
if(root.left == null && root.right == null){//无子树
return 1;
}
int leftDepth = maxDepth(root.left);
int rightDepth = maxDepth(root.right);
int max = leftDepth > rightDepth ? leftDepth : rightDepth;
return max +1;
} |
0251207c-88f9-435f-a955-57c61f1c9faa | 8 | private static boolean solvable(Field f, int area) {
for (int i = 0; i < 9; i++) {
Set<Integer> kasutusel = new HashSet<Integer>();
for (int j = 0; j < 9; j++) {
int val = f.getSlot(i, j).getValue();
if (val == 0)
continue;
if (!kasutusel.contains(val))
kasutusel.add(val);
else
re... |
c95db1b6-d1da-424e-91f8-d241dfde7255 | 0 | @Override
public String toString() {
return "[Locale object: id=" + this.id + " name="+ this.name + " desc=" + this.desc + "item=" + this.item + "]";
} |
2255f22e-e355-431b-a160-f1fef89c4cce | 9 | private DecoderBase new_decoder (int size, long max, SessionBase session, int version) {
if (options.decoder == null) {
if (version == V1Protocol.VERSION)
return new V1Decoder (size, max, session);
return new Decoder (size, max);
}
try {
... |
1efd5b29-3762-4c36-9294-8fe5939b199a | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
InMemoryRecording that = (InMemoryRecording) o;
if (userSession != null ? !userSession.equals(that.userSession) : that.userSession != null) return false;
if (watcherSession != ... |
63b62c05-d4cf-4dff-a7c2-41321a761cf7 | 3 | public void clear() {
if (head.next == head) {
return;
}
do {
Node node = head.next;
if (node == head) {
return;
}
node.unlink();
} while (true);
} |
825a1c53-a75e-483b-aa1d-bef8855dcd88 | 9 | public void drawMissileSkin(Graphics2D g)
{
if(alarmMode > 0)
{
if(alarmMode > 25)
g.drawImage(MISSILE_SHEETS[5], startX, 3, 45, 45, null);
else
{
if(closeAlarmOneTime && panel.volumeOn)
{
SoundClips.play(SoundClips.BEEP, 0);
closeAlarmOneTime = false;
}
g.drawImage(MISSILE_... |
518428e6-2d47-443e-9fca-4f3048548c32 | 4 | public boolean isSameTree(TreeNode p, TreeNode q) {
if (p == null)
return q == null;
if (q == null)
return p == null;
if (p.val != q.val)
return false;
return isSameTree(p.left, q.left)
&& isSameTree(p.right, q.right);
} |
5f3dee06-46c7-4450-bdc6-d094b6755b7d | 1 | protected static void db(final String s) {
if (BloatContext.DEBUG) {
System.out.println(s);
}
} |
d2eef909-27e8-467c-b082-62e355172512 | 6 | public static void crear(Connection cn) {
/* 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://dow... |
932bd22f-3f9e-4b0a-8ae1-6e89676451c8 | 4 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
ProcessRowData rowData = rows.get(rowIndex);
Object value = null;
switch (columnIndex) {
case 0:
value = rowData.getPagename();
break;
case 1:
value = rowD... |
c15313c8-1e0c-4eb4-a8fb-803510f7c96a | 1 | public static String getFiledName(String value){
String fileds[] = value.split("_");
StringBuffer sb = new StringBuffer();
sb.append(fileds[0]);
for (int i = 1; i < fileds.length; i++) {
String string = fileds[i];
String next = string.substring(1);
String first = string.substring(0, 1);
String pinj... |
b719ffb2-7c62-4a3b-a136-e20b82d13c24 | 3 | protected Value getElementValue(final Value objectArrayValue)
throws AnalyzerException
{
Type arrayType = ((BasicValue) objectArrayValue).getType();
if (arrayType != null) {
if (arrayType.getSort() == Type.ARRAY) {
return newValue(Type.getType(arrayType.getDes... |
479e9103-cdc2-4c2b-b156-d7eb686a071d | 8 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(affected==null)
return false;
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
MOB diseaser=invoker;
if(diseaser==null)
diseaser=mob;
if((!mob.amDead())&&((... |
4a4386b1-4d20-4d74-bda5-1c4aa7b18b14 | 6 | public List<List<Integer>> generate(int numRows) {
List<List<Integer>> res = new LinkedList<>();
if(numRows<=0){
return res;
}
List<Integer> pre = new LinkedList();
pre.add(1);
res.add(pre);
if(numRows ==1 ){
return res;
}
for(int i=1;i<numRows;i++){
List<Integer> next = new LinkedList<Inte... |
618f153a-ddec-426b-b938-6ea2c0698e44 | 2 | public int getCompoundMask(int... fileOperationMask) {
int resultantMask = 0;
if (fileOperationMask.length == 0) {
throw new IllegalArgumentException();
}
// Jnotifier uses a bitwise OR of all the masks usedto create a
// compounded mask
for (int mask : fileOperationMask) {
resultantMask = resultantM... |
d6ec228a-2a0f-4378-8cb5-08ef635f856f | 1 | double VectorMaxNorm(double[] v) {
double sum = 0;
for (int i = 0; i < v.length; i++) {
sum = Math.max(Math.abs(v[i]), sum);//*v[i];
}
return sum;//Math.sqrt(sum);
} |
48b88aca-f6b5-4de5-b1f4-f6c60d0488ca | 4 | public int bestAction()
{
int selected = -1;
double bestValue = -Double.MAX_VALUE;
for (int i=0; i<children.length; i++) {
if(children[i] != null) {
//double tieBreaker = m_rnd.nextDouble() * epsilon;
double childValue = children[i].totValue / (c... |
d77396c4-53a1-445f-8a2a-65011dca850f | 8 | private void createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu menuCommand = new JMenu("Options");
JMenu mnGridlet = new JMenu("Gridlet");
JCheckBoxMenuItem miShowGridID = new JCheckBoxMenuItem("Show ID");
miShowGridID.setSelected(true);
mnGridlet.add(miShowGridID);
miShowGridID.addItemListe... |
4e368e65-a19e-44e1-be00-69c294d8bd5b | 7 | public void render()
{
try
{
buffer = createImage(720, 720);
Graphics g = buffer.getGraphics();
Graphics i = image.getGraphics();
g.drawImage(board.getImage(), 0, 0, 720, 720, this);
i.drawImage(board.getImage(), 0, 0, 720, 720, this);
g.setColor(Color.BLACK);
g.drawRect(x - 25, y - 25, 50, 5... |
23046ef9-2b6d-40b7-96dd-2786baf5aac8 | 5 | @Override
public void keyPressed(KeyEvent ev) {
if (ev.getSource() == frame) {
if (client != null) {
try {
client.sendAction(name, ev);
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} else if (ev.getSource() == chatAr... |
7e5672eb-1158-4581-95fb-5ae542dfdedf | 4 | public static boolean degreesEqual(double degree1, double degree2) {
if (Double.isNaN(degree1) || Double.isNaN(degree2))
return false;
if (Double.isInfinite(degree1) || Double.isInfinite(degree2))
return false;
return doubleToLong(degree1) == doubleToLong(degree2);
} |
20a696dc-39f8-449d-8050-7d6e8cb27d23 | 8 | public static Test suite() {
TestSuite suite = new TestSuite();
try {
// determine all test methods in the OptionHandlerTest class
Vector<String> testMethods = new Vector<String>();
Method[] methods = OptionHandlerTest.class.getDeclaredMethods();
for (int i = 0; i < methods.length; ... |
6c067f69-b7f8-4c8d-9652-1872aa031b7e | 1 | private void DisplayColIndex() {
System.out.print(" ");
for(int colIndex = 0; colIndex<cols; colIndex++){
System.out.print(" " + colIndex + " " );
}
System.out.println();
} |
eac5cb0f-d523-4f23-9c76-6f527b402c1a | 2 | public void startActionListener(final ActionEvent e) {
try {
Settings.NpcID = Integer.parseInt(Npc.getText());
System.out.println("Stealing from: " + Settings.NpcID);
} catch (NumberFormatException ex) {
System.out.println("Your NPC ain't a number.");
}
try {
Settings.FoodID = Integer.parseInt... |
46f76b17-3af2-429a-9f24-2672fcedf3c7 | 2 | void compareFisher(int k, int N, int D, int n, double result, double p) {
double abs = Math.abs(p - result);
double diff = abs / Math.min(p, result);
if ((abs > 1E-300) && (diff > MAX_DIFF)) {
String err = "\tDifference:" + diff //
+ "\n\tpValue:\t" + p //
+ "\n\tExpected:\t" + result //
+ "\n\... |
d3098e1e-75b5-435d-9f21-1ace874a3826 | 2 | public PluginHandler()
{
PluginsList = new ArrayList<File>();
Plugins = new ArrayList<HabboPlugin>();
for(File Plugin : new File((Grizzly.class.getProtectionDomain().getCodeSource().getLocation().getPath() + "plugins/").replace("/bin", "")).listFiles())
{
if (!Plugin.getName().contains("properties"))
... |
f0f91213-30b0-425d-82e6-22bfd192dcde | 1 | public static AbstractDao getInstance(ClientType clientType) throws DaoInitException{
String dbType = ConfigurationManager.getProperty("db.type").toUpperCase();
switch (dbType) {
case "MYSQL": return MysqlDaoFactory.getInstance(clientType);
default: throw new DaoInitException(dbT... |
37e17e9e-02d9-4d6d-9867-9de6ac7463b0 | 9 | private void cargarSetAprendizaje(){
DefaultTableModel temp = (DefaultTableModel) this.tablaSetAprendizaje.getModel();
String csvFile = "dataset/diabetes_aprendizaje_perceptron.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
try {
double maximo0 = normalizacion.obtener... |
cc48e710-f084-4f53-8913-9185b68274ed | 1 | public void update(){
super.update();
delta++;
if(!isDead()){
move();
}
} |
1a68b049-c8ac-4809-b874-cc6496a60d88 | 8 | private static boolean removePlayerFromGame(String gameName,
String username) {
boolean isPlayerRemoved = false;
String playerArray[] = lobbyGames.get(gameName);
if (playerArray != null) {
// Remove username from the ... |
7f5ad1f1-5545-4541-81a7-2b1fab1265ec | 0 | public long getConstructionTime() {
return constructionTime;
} |
7930b19a-a27c-4d29-a82d-875288b02067 | 7 | public int maxDepth(TreeNode root) {
if(root==null) return 0;
if(root.left == null && root.right ==null) return 1;
if(root.left == null && root.right !=null) return maxDepth(root.right) + 1;
if(root.left != null && root.right ==null) return maxDepth(root.left) + 1;
return Math.max(maxDepth(ro... |
f2bf5228-c171-4579-966a-abd5b0493b84 | 6 | public boolean move( int dir, Game game ) {
switch (dir) {
case LEFT:
Point newPos = new Point( _pos.x - 1, _pos.y );
if (_game.isMovable( newPos, _block ) ) {
_pos = newPos;
}
break;
case RIGHT:
newPos = new Point(_pos.x+1, _pos.y);
if (_game.isMovable( newPos, _block ) ) {
... |
24103f77-f19b-4742-87ab-f1092e84f7f6 | 5 | public boolean executeTransition(int k)
{
ArrayList<Integer> markings = isActive();
if (markings == null) {
return false;
}
int marking = markings.get(k); //token
/* Minus for input arcs */
for(Arc arc : listOfInArcs)
{
AbsPlace outElement=(A... |
9991cbf7-36a1-47c7-b62d-f16c62e23a97 | 6 | public static String getName(final Entity e) {
if (e == null)
return null;
if (e instanceof org.powerbot.game.api.wrappers.interactive.Character) {
return ((org.powerbot.game.api.wrappers.interactive.Character) e).getName();
} else if (e instanceof GroundItem) {
Item it = ((GroundItem) e).getGroundItem()... |
15856faa-1e6b-4014-b3b2-73135e15b4f7 | 9 | public void setCapacity(int newCapacity) {
if (newCapacity > _capacity) { // Capacity increases.
for (int i = _capacity; i < newCapacity; i++) {
EntryImpl entry = new EntryImpl();
entry._after = _poolFirst;
_poolFirst = entry;
}
} e... |
1ee9d787-d034-4e15-ae13-890ab7d4a0a8 | 9 | public List<Square> getAdjacentSquares(Location location)
{
List<Square> adjacent = new LinkedList<Square>();
int row = location.getRow();
int col = location.getCol();
for(int rOffset = -1; rOffset <= 1; rOffset++) {
int nextRow = row + rOffset;
if(nextRow >= 0 && nextRow < rows) {
... |
89249183-2701-4619-be9b-b3e0e551f1b7 | 4 | private void createButtons() {
//We make use of anonymous class's here.
craftGridBuySlotYes = new Button(this, 490, 250, 24, 16, setImg("images/utility/yes.png")){
@Override
public void clickAction() {
if(game.getCraftGridBuySelected()!=null){
if(getMoney()>=craftGridBuyCost){
int xx = (int) cr... |
916c8e40-b3b7-4ad8-98bc-f87ec45bd642 | 8 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// get the size of the matrix to rotate.
String matrixSizeLine = in.nextLine();
Scanner matrixSize = new Scanner(matrixSizeLine);
int width = matrixSize.nextInt();
int height = matrixSize.nextInt();
// Keep readi... |
146798a5-4012-4972-8062-76410045b98b | 6 | @SuppressWarnings("unchecked")
public static List<Member> deSerialiseMembers(){
List<Member> deser_members = null;
try {
FileInputStream input_file = new FileInputStream("members.ser");
ObjectInputStream input = new ObjectInputStream(input_file);
deser_members = (List<Member>) input.readObject();
inpu... |
bdc62351-3e45-49e2-9a05-20655ae07483 | 0 | public ConnectionDisconnectEvent(Object source, long idConnection) {
super(source);
this.idConnection = idConnection;
} |
73418d9c-cd22-4941-aa0a-425c2b0bfddb | 8 | @Override
public double calculateFractalWithoutPeriodicity(Complex pixel) {
iterations = 0;
double temp = 0;
Complex[] complex = new Complex[1];
complex[0] = new Complex(pixel);//z
Complex zold = new Complex();
Complex zold2 = new Complex();
if(parser.found... |
3e570b87-9ca4-480e-8e37-8201e63a8f03 | 2 | public static void main(String[] args) {
Shape shape = new Shape();
Class cls = shape.getClass();
if (cls.isAnnotationPresent(WorkInProgress.class)) {
System.out.println("Shape class does require some work");
WorkInProgress progress = (WorkInProgress) cls
.getAnnotation(WorkInProgress.class);
System... |
c85c13a5-78bb-4129-a6f9-317b324441ae | 0 | @AfterClass
public static void tearDownClass() {
} |
2f5b941d-dca6-42f2-b096-a6397f9aa4df | 8 | public void stabilize() {
if (dx != 0) {
if (dx > 0) {
dx -= 1;
} else {
dx += 1;
}
}
if (dy != 0) {
if (dy > 0) {
dy -= 1;
} else {
dy += 1;
}
}
x += dx * 0.001;
y += dy * 0.001;
if (x < -1.3) {
x = -1.3f;
dx = 0;
}
if (x > 1.3) {
x = 1.3f;
dx = 0;
}
... |
93e2d8e3-51dc-4d70-9d30-d69168db5cb4 | 3 | public void showInventory()
{
if(player.getInventorySize() > 0)
{
String printString = "Je tas bevat de volgende voorwerpen" + "\n";
int itemNumber = 1;
for (Iterator it = player.getInventory().iterator(); it.hasNext();) {
Item roomItem = (Item) ... |
6309ae8f-4554-446b-b81f-a99ab61c37ca | 6 | public static boolean validBST(int[] values) {
//if less than two elements in the array.
//its always valid
if (values.length < 2) return true;
int i = 0;
//find the beginnig of right sub tree
for (; i < values.length && values[i] < values[values.length - 1]; i++);
//now valid right subtreee
... |
e5e44d7c-9b28-430a-8052-c751b4425eca | 0 | public void setMin(long value) {
this.min = value;
} |
8c21bbf5-8775-47ba-8ceb-cc6ff7f41ff8 | 1 | public List<String> sortedKeys() { //Returns a List of Strings, sorted based on their corresponding values.
List<String> keysList = new ArrayList<String>();
Iterator<IntKeyValuePair> i = getKVPs().iterator();
while(i.hasNext()) {
keysList.add(i.next().getKey());
}
return keysList;
} |
17a36c27-92b2-47e9-bd27-d9a3bf676b5d | 6 | public void print() {
System.out.println(" A B C D E F G H I J");
for (int r = 0; r < size; r++) {
if (r == size) {
System.out.print(r + "|");
} else {
System.out.print(r + " |");
}
for (int k = 0; k < size; k++) {
if (k == (size - 1)) {
if (board[r][k].getBoat()) {
System.out.p... |
f36c7b25-2e64-47f9-92c3-4ba2210c6a4c | 6 | private boolean simplifyRules() {
boolean simplifyPerformed = true;
final List<RuleConstraint<T>> addedRules = new ArrayList<RuleConstraint<T>>();
final Analyze<T> analyze = new Analyze<T>() {
@Override
public int getDepth() {
return GameAnalyze.this.getDepth();... |
999ed077-2879-404e-b735-f59b985e8fb3 | 1 | void setIndex(int i) {
this.index = i;
if (hind != null) {
hind.setHeapIndex(i);
}
} |
6c07bc6e-6d4f-4465-be6d-423af44f6af5 | 6 | public void delete(int recNo) throws RecordNotFoundException, DatabaseException {
logger.entering("DataDBAccess", "delete", recNo);
synchronized (mutex) {
final Long lockCookie = Thread.currentThread().getId();
Long ownerCookieValue = locker.getOwner(recNo);
if (recNo... |
919c8110-64f2-449e-badb-50a5545c43af | 6 | @Override
public void keyReleased(KeyEvent e) {
if ((e.getKeyCode() == KeyEvent.VK_W)
|| (e.getKeyCode() == KeyEvent.VK_UP)) {
jumpKeyPressed = false;
}
if ((e.getKeyCode() == KeyEvent.VK_D)
|| (e.getKeyCode() == KeyEvent.VK_RIGHT)) {
rightKeyPressed = false;
}
if ((e.getKeyCode() == ... |
728edc68-da0f-4706-a0c5-e370f0075185 | 6 | public int firstMissingPositive(int[] A) {
// Start typing your Java solution below
// DO NOT write main() function
int n = A.length;
int i = 0;
for (i = 0; i < n; i++) { // 预处理
if (A[i] <= 0)
A[i] = n + 1;
}
for (i = 0; i < n; i++) {
int val = Math.abs(A[i]); // 只取正数部分
if (val <= n)
A[va... |
c9a632e4-1c18-48d0-8267-54ae0b4ccb25 | 0 | public long getLastAccessTime() {
return lastAccessTime;
} |
b3f69575-d5ff-45ea-94f7-fe2041ccae49 | 1 | public void visitMethodInsn(final int opcode, final String owner,
final String name, final String desc) {
buf.setLength(0);
buf.append(tab2).append(OPCODES[opcode]).append(' ');
appendDescriptor(INTERNAL_NAME, owner);
buf.append('.').append(name).append(' ');
appendDescriptor(METHOD_DESCRIPTOR, desc);
bu... |
3815f83a-eec1-41de-824c-1cb6127acf2f | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Item target=super.getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_UNWORNONLY);
if(target==null)
return false;
if(!(target instanceof DeadBody))
{
mob.tell(L("Yo... |
0957b1df-e4e9-47b8-b98e-dc6f58c0d68d | 3 | public void addNewContact(String name, String notes)
{
try
{
if(name.equals(null) || notes.equals(null))
{
throw new NullPointerException();
}
Contact newContact = new ContactImpl(name,notes,this.generateUniqueID());
this.contactList.add(newContact);
}catch(NullPointerException ex){
Sy... |
7b41aa94-6307-41a4-83ac-002f3ea764b1 | 2 | @Override
public void joinGame(IPresenter presenter, CatanColor color, int gameID) {
JoinGameResponse joinResponse = presenter.getProxy().joinGame(color, gameID, presenter.getCookie());
presenter.setPlayerDescriptionsForGame(presenter.getGames().get(gameID).getPlayerDescriptions());
presenter.setCookie(joinRespo... |
6f22ffaa-f0b3-45b6-927f-f92dd0ebc0f6 | 1 | public JsonLoader(ViusicMain main){
this.main = main;
profile = new Profile();
profile.collections = main.getCollections();
System.out.println(main.getCollections());
try {
reader = new BufferedReader(new FileReader("../src/saveData/saveFile.json"));
readAndBuild();
} catch (FileNotFoundException e) ... |
46207f53-3c77-4598-94f9-8ca6f7a71c60 | 1 | */
public void addInstruction(final Instruction inst) {
Assert.isTrue(!inst.isJsr() && !inst.isConditionalJump(),
"Wrong addInstruction called with " + inst);
this.next = null;
addInst(inst);
} |
ee20a7a0-9eb2-42ad-9791-97093b2ca052 | 5 | public void run() {
int answer = 0;
for (int i = 2; i < 10000; i++){
int input = i;
int sumA = 0;
int sumB = 0;
List<Integer> list = new ArrayList<Integer>();
list = MathFunctions.factorsOfNumber(input);
for (int j = 0; j < list... |
8770afdd-8d0b-45c9-8c43-ef0eff64f0e0 | 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 Computadora)) {
return false;
}
Computadora other = (Computadora) object;
if ((this.idComputadora == null && ot... |
4f0e2443-b76b-42d6-a03c-174090843ed8 | 1 | public boolean isGravityOnStatus() {
if(frame == null) buildGUI();
return gravityOnStatus.isSelected();
} |
6f8c4068-64d0-4a82-a246-2cd24263e8ad | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=getTargetAnywhere(mob,commands,givenTarget,false,true,false);
if(target==null)
return false;
final Ability A=target.fetchEffect(ID());
if(A!=null)
{
A.unInvoke();
mob... |
791520b1-9e1f-4535-a282-701c4cb5ac80 | 8 | private static int[][] removeRowAndCol(int[][] matrix, int row, int col){
//preconditions
if(matrix == null)throw new IllegalArgumentException("matrix must not be null");
for(int i = 0; i < matrix.length; i++){
if(matrix.length != matrix[i].length)throw new IllegalArgumentException("matrix must be square!");
... |
ac6f2ee5-cfd4-4a60-a879-b2a4be522ef9 | 8 | public ArrayList<Profile> getProfiles()
{
File profileDBDir = new File(TestsManager.ProfilesDBPath);
if (profileDBDir.isDirectory() == true)
{
this.profiles = new ArrayList<Profile>();
File[] profileFiles = profileDBDir.listFiles(new ProfilesFileFilter());
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.