method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d110f072-bbf7-4f89-b9d8-a9239944415c | 2 | public boolean registraEquipo(HttpServletRequest request, HttpServletResponse response) throws IOException {
ConexionBD bd = new ConexionBD();
request.setCharacterEncoding("UTF-8");
String activoFijo = (String) request.getParameter("activoFijo");
int actFijo = (activoFijo.equals("")) ? 0... |
a75bb4be-9406-4130-97a4-74990eef5129 | 0 | public void addChatGuiListener(ChatGuiListener listener) {
chatGuiListener.add(listener);
} |
56418554-3865-45ba-9af6-2ab144ff6eb2 | 1 | public T pop() {
int length = size();
if (length == 0) {
throw new EmptyStackException();
}
return remove(length - 1);
} |
482cf3f5-4b12-4305-8e7b-ddc5170c6b55 | 9 | private void process_bmpcache2(RdpPacket_Localised data, int flags,
boolean compressed) throws RdesktopException, IOException {
Bitmap bitmap;
int y;
int cache_id, cache_idx_low, width, height, Bpp;
int cache_idx, bufsize;
byte[] bmpdata, bitmap_id;
bitmap_id... |
d17c3e5c-d45a-43da-bf20-2508258161d6 | 1 | private KeyEventHandler() {
registeredListeningObjects = new SynchronisedGameQueue<IKeyboardEventable>();
waitingEventLists = new ConcurrentHashMap<KeyEventType, Collection<EventHolder>>();
for (KeyEventType eventType : KeyEventType.values()) {
waitingEventLists.put(eventType, Collections.synchronizedList(new... |
51d427fa-e608-4814-99a0-385735e3e7a3 | 2 | public Animation getAnimationLeft(){
if(dead){
return death;
}
if (type == Type.CAT){
return catAnimLeftWalking;
} else {
return dogAnimLeftWalking;
}
} |
77b9fa25-50a8-4f4a-bd2b-a3283fc99fb4 | 5 | public static String stripLeading(final String string, final char ch) {
//// Preconditons
if (string == null)
throw new InvalidParameterException("string cannot be null");
int index = 0;
final int string_length = string.length();
if (string_length == 0)
return string;
while (tru... |
fb8364d5-493b-46de-b6f4-67f2dd616a78 | 8 | public static byte[] decodeBase64(byte[] base64Data) {
// RFC 2045 requires that we discard ALL non-Base64 characters
base64Data = discardNonBase64(base64Data);
// handle the edge case, so we don't have to worry about it later
if (base64Data.length == 0) {
return new byte[0]... |
df9a2a91-ed9a-45b5-af94-07fd74d37508 | 3 | public void actionPerformed (ActionEvent e)
{
if (e.getSource() instanceof JButton)
{
//make new jframe asking "are you sure"
//if yes, client.disconnect
//if no, kill jframe and do nothing
JOptionPane sure = new JOptionPane ("Exit audiochat", JOptionP... |
191ee778-3ea4-4faf-b2e5-a0931e931c28 | 9 | private static void doCrypt(String in, String out, String pass, boolean encrypt, String encoding) throws IOException, InvalidEncodingException {
Cryptographer crypt = new CBCCryptographer();
CryptographerHandler bm = new CryptographerHandler(crypt);
verbosePrint("Using "+bm.getCryptoMode());
... |
16d18052-66a4-4a0d-8822-73780270d7b2 | 1 | @Override
public void run() {
arr_data = History.showHistory();
data = new Object[arr_data.size()][];
for (int i = 0; i < arr_data.size(); i++) {
data[i] = arr_data.get(i).Array();
}
this.fireTableDataChanged();
} |
74213e9c-09d2-4139-9a2f-c92b2fb96e6d | 8 | private static String maskPassword(String proxyString) {
String retVal = proxyString;
if (proxyString != null && !"".equals(proxyString.trim())) {
boolean hasSchemeDefined = proxyString.contains("http:") || proxyString.contains("https:");
boolean hasProtocolDefined = proxyString.... |
331f09d8-289e-4a1f-a76d-905cf4be1cf1 | 7 | public void shootArrow(char x) {
if (running) {
if (x == 'A' || x == 'D') {
if (hunterLocation.y == wumpusLocation.y) {
hitWumpus = true;
}
} else if (x == 'W' || x == 'S') {
if (hunterLocation.x == wumpusLocation.x) {
hitWumpus = true;
}
}
hitSelf = true;
updateCurrentState()... |
47279841-e0d2-4d3b-9fa6-453947b3655f | 7 | public Ticket in(Car car) {
if(isFull()) {
throw new ParkException("停车场已满,不能停车了。");
}
int num = this.parkBoyList.size();
if(this.park != null) {
num += 1;
}
Random random = new Random();
while(true) {
int i = random.nextInt(num);
if(i == 0 && !this.park.isFull()) {
return park.in(car);
... |
39989c7e-1052-4c17-85b2-4e67f100cf39 | 0 | public TextFieldListener(JTextField field, Preference pref) {
setTextField(field);
setPreference(pref);
} |
99b81d52-bcc9-4f57-806e-46fe9d2fd9b4 | 6 | private void Load(String file)
{
BufferedReader reader;
try
{
reader = new BufferedReader(new FileReader(file));
String line = null;
while ((line = reader.readLine()) != null)
{
if (!line.equalsIgnoreCase(""))
{
String[] p = line.split(" ");
Waypoint w = new Waypoint(Integer.valueO... |
dc5116e7-8f1d-4068-8768-d540696156ca | 3 | private List<String> GetZipNames(String projectName){
String zipArray="";
List<String> zipNames=new ArrayList<String>();
@SuppressWarnings("unchecked")
List<HierarchicalConfiguration> appList = SystemConfig.getInstance().configurationsAt("apps.app");
for (Iterator<HierarchicalConfiguration> iterator = appList... |
1bb7c456-c58d-4da3-859d-4ae0ea1fa58e | 4 | public void drawNewPoints() {
if (imageGfx == null) {
imageGfx = image.getGraphics();
}
if (activeTool == Tool.ERASER) {
imageGfx.setColor(Color.white);
} else {
if (color == null) imageGfx.setColor(Color.black);
else imageGfx.setColor(color);
}
for (Point p : pointsToDraw) {
imageGfx.fillOva... |
0697b593-1007-455a-9388-f3b4e47d4c7c | 0 | public int getX() {
return this.x;
} |
eaeed3e6-1320-4f53-b0da-4f97d95b65d0 | 3 | @Override
public void handleEvent(Event event) {
if (event.getType() == EventType.END_ACTION)
endActionUpdate();
else if (event.getType() == EventType.END_EFFECT)
if (isValidEndEffectEvent(event))
removeEffect();
} |
556fa186-0114-40bd-8df0-eb965903e72c | 8 | public boolean moveDown() {
// Block invalid moves
if (!canMoveDown)
return false;
boolean result = false;
for (int j = 0; j < dim; j++) {
for (int i = dim-2; i >= 0; i--) { // Can skip the bottom most row
// Skip empty tiles
if (isTileEmpty(i, j))
continue;
// Stepping in... |
468a273d-17c6-4e0b-8640-18f74915aecd | 0 | public JustShoot() {
// addSequential(new Command() {
// public void initialize() {
// new SetColor(new Color(0,0,255)).start();
// }
// protected void execute() {}
// protected boolean isFinished() {
// return true;
// }
// ... |
70d36165-f8a6-422e-beed-8410a4afd337 | 9 | @Override
public short[] getTerrainData(int px, int pz, int sx, int sz)
{
short[] res = base.getTerrainData(px, pz, sx, sz);
for (int x = 0; x < sx; x++)
for (int z = 0; z < sz; z++)
{
int y;
int d = depth;
boolean paint = ... |
366513cd-8f05-43b0-b778-29d8b900d16c | 5 | public static void saveLifestone(String bWorld, int bX, int bY, int bZ) throws SQLException {// Block
// block
// String bWorld = block.getWorld().getName();
// int bX, bY, bZ;
// bX = block.getX();
// bY = block.getY();
// bZ = block.getZ();
String table = "Lifestones";
Connecti... |
610900a7-7997-4a6b-aef7-e69d9079da84 | 6 | private void close(Connection conn, PreparedStatement stmt,
ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (Exception ex) {
}
}
if (stmt != null) {
try {
stmt.close();
} catch (E... |
d050cd4b-a215-4040-93ad-97162ae5cdca | 8 | public void load() {
try {
BufferedReader br = new BufferedReader(new FileReader("src/save.txt"));
String line;
while ((line = br.readLine()) != null) {
if (line.equals("max")) {
this.setMaxLevel(Integer.parseInt(br.readLine()));
}
if (line.equals("current")) {
... |
302b8092-26a4-46a2-a860-8a6dd454f557 | 6 | public void optField() {
Class<?> clazz;
try {
clazz = Class.forName("com.rock.reflect.User");
User u = (User) clazz.newInstance();
Field f = clazz.getDeclaredField("userName");
f.setAccessible(true);//设置为true后,可访问私有变量
System.out.println(f);
f.set(u, "rock");
System.out.println(u.getUserName(... |
961b5159-5067-43c7-a3ca-d162656542e8 | 2 | public int getButton(int index) {
try {
if (buttonState[index])
return 255;
else
return 0;
} catch (Exception e) {
// this index doesn't exist, return 0;
return 0;
}
} |
f34dea67-a0be-4a70-bcec-4e1885463a1f | 1 | private Reader[] open(String... f) throws FileNotFoundException {
Reader[] r = new Reader[f.length];
for (int i = 0; i < r.length; i++) {
r[i] = new FileReader(this.getClass().getResource(f[i]).getFile());
}
return r;
} |
f4714284-b32b-4bbd-a9d4-80358a37dd38 | 3 | public Expression getValueBySlot(int slot) {
slot--; // skip this parameter (not an outer value)
for (int i = 0; i < headCount; i++) {
if (slot == 0) {
Expression expr = head[i];
if (i >= headMinCount)
headMinCount = i;
return expr;
}
slot -= head[i].getType().stackSize();
}
return nul... |
4283ba4c-175a-4fe7-9f71-d5c884f65043 | 1 | @Override
public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException {
List paramList1 = new ArrayList<>();
List paramList2 = new ArrayList<>();
StringBuilder sb = new StringBuilder(UPDATE_QUERY);
String ... |
4e4d9e5e-ae87-47e0-9fa3-22c5b152a046 | 6 | public String addBinary(String a, String b) {
int aLast = a.length() - 1;
int bLast = b.length() - 1;
String result = "";
int carry = 0;
while (aLast >= 0 || bLast >= 0) {
int aNum = 0, bNum = 0;
if(aLast >= 0) aNum = Character.getNumericValue(a.charAt(aLast));
if(bLast >= 0) bNum = Character.getNu... |
9edbd3a7-052d-4ae5-b4c9-c29efece55bb | 0 | public int CalculateOffset(int oldaddress,int newaddress){
//Calculates offset in case of labels
int x=0;
x=(newaddress-oldaddress)/2-1;
return x;
} |
ae7a10f7-14ef-451a-a229-de4fa6d2715f | 2 | public static void loadProperties(String configPath) throws IOException {
properties = new Properties();
String path = (configPath == null) ? Constants.PROP_FILENAME : configPath;
try {
properties.load(new FileInputStream(path));
validateProperties();
logger.info("config.properties file loaded.");... |
b6473096-bbb9-4cff-97e9-3a361f7e16cb | 1 | public void mouseMove(MouseEvent e)
{
for(UIContent content : Contents)
{
content.contentMouseMove(e);
}
} |
5c851d43-72a3-42d7-aa26-8437860cf39d | 7 | public static MoodleGroupUser[] getMembersFromGroupIds(long[] groupids) throws MoodleRestGroupException, UnsupportedEncodingException, MoodleRestException {
Vector v=new Vector();
MoodleGroupUser user=null;
StringBuilder data=new StringBuilder();
String functionCall=MoodleCallRestWebServ... |
707b6272-cda2-4306-a185-091e3b7a036d | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
6958b37c-c220-4cf5-806e-87983f7ff93b | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
boolean isWateryEnough = CMLib.flags().isWateryRoom(mob.location());
if(!isWateryEnough)
{
if(mob.location().resourceChoices().contains(Integer.valueOf(RawMaterial.RESOURCE_FISH)))
isWateryE... |
0f110caa-d7f1-498a-9677-4d6053226a6f | 0 | @Test(expected=IllegalArgumentException.class)
public void testGcdInvalidInput() {
// Integers must be non-negative
int q = 1;
int p = -5;
BasicMath.gcd(p, q);
} |
f4f4b367-0124-4566-9bb3-6eb94eb8c1f2 | 0 | public Client(){
} |
708c9211-e72e-40e8-bad5-b06871380840 | 3 | public void startDataConnection(Client c, String device) {
if ((activeClient != null) && (activeDevice != null)) {
stopDataConnection(activeClient, activeDevice);
}
c.startDataConnection(device);
activeClient = c;
activeDevice = device;
List<ClientChangedListener> copy = new ArrayList<ClientChangedListen... |
953913f6-a734-4a00-a01b-82b684961748 | 2 | public void mapSize() {
carte = new Map();
JLabel labels[] = new JLabel[(19 * 49)];
String bufferMap = carte.lire("./ressources/map.txt");
for (int i = 0, j = 0; i < bufferMap.length(); i++) {
if (bufferMap.charAt(i) != '\n') {
colonne = i;
}
... |
702a6697-fa60-43ec-a729-8a2e08ad8885 | 8 | public void drawWindow(RenderEngine renderEngine, FontRenderer fontRenderer) {
if (!(this instanceof SceneScreen)) {
if (this instanceof IRendersEventProvider) {
IRendersEventProvider provider = (IRendersEventProvider) this;
provider.preRenderScreen(renderEngine, font... |
d1954bb8-3f12-4223-ae1f-fea5e9f1c43f | 5 | @Override
public void paintComponent(Graphics G){
super.paintComponent(G);
if(started){
//button building
G.drawImage(BuildImages[0], 578, 0, null);
G.drawImage(BuildImages[1], 578, 80, null);
//G.drawImage(BuildImages[2], 578, 498, null);
G.d... |
881af849-1725-4ab7-8015-fa69c7eb8d74 | 6 | public static void main(String[] args) {
try {
ConfigManager configManager = new ConfigManager();
Map<String, ConfigEntry> config = new HashMap<>();
if (!configManager.loadConfig(config)) {
System.out.println("Invalid configuration file!");
... |
c3279624-4e3d-406e-ba2a-e74d45b97716 | 5 | public int[] getComplexErrorCodes() {
Map<String, String> allFields = getFields();
List<Integer> errorCodeList = new ArrayList<Integer>();
for (Entry<String, String> field : allFields.entrySet()) {
String fieldKey = field.getKey();
if (fieldKey.startsWith("Errors.")) {
int nextDot = fieldKey.indexOf('.'... |
c6b04bbe-50c2-4b4b-8f6d-30bec246f2c7 | 0 | public String getPhone() {
return Phone;
} |
405d1d6a-2f8d-42e3-8c83-beaa3e86891e | 3 | public void run() {
System.out.println("Enter Portal");
if(Util.WalkToAndClick("Enter", Util.portals)) {
int time = 0;
while(validate() && time <= 5000) {
time += 50;
Time.sleep(50);
}
}
} |
c200bf26-1852-4df8-b41d-dd4e8b36c822 | 0 | public Command(String _name, String _command, int _numParams, String _help) {
this.name = _name;
this.command = _command;
this.numParameters = _numParams;
this.helpMessage = _help;
} |
d02a3ed1-7b36-47e9-b8fa-ed582261e725 | 8 | public static WordLocation parseWordLocation(String obj) {
WordLocation wl = new WordLocation();
String data[] = obj.split("\n");
if( data.length != 2)
return null;
String tokens[] = data[0].split("[=]|[\\{]|[\\}]|[,]");
try {
if(data[0].indexOf("WordLocat... |
59f223c1-58ec-4af7-ac06-ebc8c99e5143 | 4 | public void setInfo(String info) {
// レコード情報設定
this.info = info;
String[] tmp = info.split(";");
// 化合物名設定
this.name = tmp[0].trim();
// ソート用化合物名設定
this.sortName = tmp[0].trim();
// 付加情報設定
StringBuffer addition = new StringBuffer();
for (int i=0; i<tmp.length; i++) {
if (i==0) {
c... |
8653623c-67de-4f95-b348-84bdc1ebf1af | 5 | public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == JButton_Exit)
JButtonExit_actionPerformed(event);
else if (object == JButton_NewCCAccount)
JButtonNewCCAC_actionPerformed(event);
else if (object == JButton_GenBill)
JButtonGenerate... |
59ba4e3d-e9a8-4e7f-9e3d-b3accbeacad8 | 0 | public String getTitle() {
return title;
} |
423210e0-bb01-4779-84b1-79d8132d5356 | 1 | public void addTreasureChest(TreasureChest chest)
{
if(possibleTreasures.contains(chest)) return;
possibleTreasures.add(chest);
} |
0ee59f62-240c-4b9d-8766-9ea5a94b9752 | 3 | @Test
public void testRunStartServerInvalidSpot()throws Exception{
AccessControlServer server = new AccessControlServer(1930);
server.start();
SpotStub spot = new SpotStub("999",1930);
spot.start();
sleep(1000);
String ans = "";
int x = 0;
... |
583622db-955c-4200-b537-d7e1940696e2 | 2 | int nextDescriptorOffset (int offset)
{
if (data.length < offset)
return -1;
offset += 0xff & data [offset];
if (data.length <= (offset + 2))
return -2;
return offset;
} |
24be8369-b801-4dc3-a19b-6ac437f80499 | 1 | public void testLeapYearRulesConstructionInvalid() {
// 1500 not leap in Gregorian, but is leap in Julian
try {
new DateMidnight(1500, 2, 30, GJChronology.getInstanceUTC());
fail();
} catch (IllegalFieldValueException ex) {
// good
}
} |
8de34469-c092-40b3-a77c-26edbc60a4cd | 7 | @Override
public void run() {
try{
_user = new ClientUDP();
_user.sendToServer(new MessageUDP(_CSName, _CSPort, Protocol.LIST + "\n"));
System.out.println(">> Sent list");
_bufferUDP = _user.receiveFromServer();
_arguments = _bufferUDP.getMessage().split(" ");
if(_arguments[0].equals(Protocol.LIST_... |
70301275-370d-46f3-a28a-6f8cdebcc6d8 | 0 | public void setjLabelBilan(JLabel jLabelBilan) {
this.jLabelBilan = jLabelBilan;
} |
ff996d02-0430-43e8-b8d4-fc685bade12e | 6 | public String getLyricsWebPage(String artistName,String songName){
try {
if (artistName.equals(null) || artistName.equals("") || songName.equals(null) || songName.equals(""))
return null;
String url = buildUrl(artistName,songName);
Document document = reader.read(url);
// XMLUtil.writeToFile(d... |
6c5d30ae-16dc-4486-8c8b-fb7e12578442 | 9 | public void readParams() throws IOException {
Set<String> allParams = paramsSet();
// Read normal non-multipart params.
for (String name : allParams) {
if (!mParent.isParameterSet(name)) {
continue;
}
mParamTable.pu... |
a7b39e4f-e56b-4c34-9074-3fd87cb92b37 | 7 | Photon emit(Atom atom) {
Electron e = atom.getElectron(0);
if (e == null)
return null;
ElectronicStructure es = model.getElement(atom.id).getElectronicStructure();
int m = es.indexOf(e.getEnergyLevel());
if (m == 0)
return null; // electron already in the ground state
if (!e.readyToGo(model.getModel... |
e1d30736-f83b-4e21-9b56-5adbf2543211 | 1 | public int unwrapInteger() {
if (!isInteger) { //If not integer, return floatingPointOperand cast to int (fraction part lost)
int castIntOperand = (int) floatingPointOperand; //Create temporary value so as not to overwrite true value
return castIntOperand;
}
return intOperand;
} |
015b0354-0bbf-44fa-ab5a-2574ffde27fb | 3 | public Key keyOf(int i) {
if (i < 0 || i >= NMAX) throw new IndexOutOfBoundsException();
if (!contains(i)) throw new NoSuchElementException("index is not in the priority queue");
else return keys[i];
} |
28116d55-fd98-4ae6-8b11-baac7e36d850 | 5 | @Override public boolean getOption(String opname){
if(opname == "Ages"){ return ages;}
if(opname == "Fades"){ return fades;}
if(opname == "Any"){return any;}
if(opname == "All"){return all;}
if(opname == "Mirror"){ return mirror;}
return false;} |
8273f78e-7614-453f-9296-dd256412ca98 | 5 | public final void update(Level level, int x, int y, int z, Random rand) {
int var6 = level.getTile(x, y - 1, z);
if(level.isLit(x, y, z) && (var6 == DIRT.id || var6 == GRASS.id)) {
if(rand.nextInt(5) == 0) {
level.setTileNoUpdate(x, y, z, 0);
if(!level.maybeGrowTree(x, y, z)... |
57abfd99-9af0-42ad-809e-4c105b6f84a5 | 4 | protected Constructor<? extends T> getCtor() {
if(ctor == null)
try {
ctor = projectileType.getDeclaredConstructor(actor.Actor.class);
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.pr... |
53541928-5cf3-45b9-946c-71eefd75e6de | 7 | @Override
public boolean okMessage(Environmental host, CMMsg msg)
{
if((msg.source()!=affected)
&&((msg.target()==pocket)||(msg.tool()==pocket))
&&(CMath.bset(msg.sourceMajor(),CMMsg.MASK_HANDS)
||CMath.bset(msg.sourceMajor(),CMMsg.MASK_MOVE)
||CMath.bset(msg.sourceMajor(),CMMsg.MASK_DELICATE)
||... |
64c428f8-9407-4095-a98f-fba531d03205 | 1 | public JSONObject getJSONObject(String key) throws JSONException {
Object object = this.get(key);
if (object instanceof JSONObject) {
return (JSONObject) object;
}
throw new JSONException("JSONObject[" + quote(key)
+ "] is not a JSONObject.");
} |
1c6a75e8-ff00-42de-b178-04c29e223870 | 5 | public void reloadConfig() {
if (configFile == null) {
configFile = new File(master.getDataFolder(), configFileName);
}
config = YamlConfiguration.loadConfiguration(configFile);
if (configFileName.equals("localization.yml")) {
InputStream defDataConfigStream = master.getResource("localization.yml");
... |
71a1c637-62ed-4ae0-880e-5ae63d001c56 | 3 | static int getFactor(final double d, final int max)
{
if (d == 0)
{
return 0;
}
int factor = 0;
do
{
final double scale = getDScale(factor);
final double scaled = d * scale;
if (scaled == (long) scaled)
{
return factor;
}
else
{
factor++;
}
}
while (factor < max);
return max;
... |
e8b21217-c27e-4391-a278-18528a4d0a17 | 8 | public void testValidityOfRanks() {
FiveEval fiveEval = new FiveEval();
System.out.println("testing ranks...\n");
for (int i = 6; i < 52; i++) {
for (int j = 5; j < i; j++) {
for (int k = 4; k < j; k++) {
System.out.println("" + i + "_" + j + "_" + k + "\n");
for (int l = 3; l < k; l++) {
f... |
f90851b6-2792-48ac-befc-2f77ca7b9d78 | 1 | public static void isNull(Object object, String message) {
if (object != null) {
throw new IllegalArgumentException(message);
}
} |
bad480c8-804b-4537-8830-28948e306e87 | 5 | final String _readValue_() throws IOException, IllegalArgumentException {
final Reader source = this._reader_;
final StringBuilder result = this._builder_;
result.setLength(0);
while (true) {
int symbol = source.read();
switch (symbol) {
case -1:
case '\r':
case '\n':
return result.toStri... |
1b5a5411-2b5a-4314-abb6-0052cf97bfa6 | 0 | public void listRoot() throws IOException {
this.list("/");
} |
71a1aad6-4cc5-4926-8476-e39ac510b3b4 | 2 | public static boolean isHighScore(int score){
Integer scorez = 0;
for(int i = 0; i < 5; i++){
scorez = Integer.parseInt(topScores[i][1]);
if(score > scorez){
return true;
}
}
return false;
} |
99b9a84c-f8cc-446f-baff-d81d56751fc4 | 8 | public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
68cd49df-4d16-4897-b90c-e47ebf721ffc | 5 | public void mouseExited(MouseEvent paramMouseEvent) {
if (ImageButton.this.Enabled)
{
if (ImageButton.this.MouseOverImage != null)
{
if ((ImageButton.this.On) && (ImageButton.this.OnImage != null))
ImageButton.this.rawSetImage(ImageButton.this.OnImage);
else {... |
9d5e1d00-44fc-4b65-beb7-27a2e62d5e99 | 4 | private boolean winCheck() {
String winner = Resolution.resolutionWinCheck();
if(winner.equals("X")){
JOptionPane.showMessageDialog(null, "X wins the game!", "Winner", 0);
return true;
}
else if(winner.equals("O")){
JOptionPane.showMessageDialog(null, "O wins the game!", "Winner", 0);
return true;
... |
b31cddd6-d7e4-4c88-b1a5-b3eb5b59b31e | 4 | private void neuMalen(Graphics2D g) {
g.setColor(Color.WHITE);
g.scale(zoom, zoom);
g.fillRect(0, 0, (int) (rahmen.getWidth() / zoom),
(int) (rahmen.getHeight() / zoom));
g.setColor(Color.BLACK);
try {
for (Geo geo : statisch) {
geo.zeichnen(g);
}
} catch (Exception ... |
85b41c7a-4e11-4059-9084-dad83bcb88e8 | 7 | public static int findFloor(int[] input, int start, int end, int k) {
if(k < input[start]){
return -1;
}
if(k > input[end]){
return input[end];
}
int mid = (start +end)/2;
if(input[mid]<=k && input[mid+1] > k){
return input[mid];
... |
6c2b4285-a5ef-4e23-a694-1fd48050d672 | 2 | private void deleteCard(){
int i;
System.out.println("----------- Delete a Card -----------");
System.out.print("Enter the index of the card you want to delete (start at 0): ");
i = sc.nextInt();
sc.nextLine();
if(i >= 0 && i <= this.deck.numberOfCards() - 1){
this.deck.deleteCard(i);
System.... |
cead1a99-4bbd-41ce-acee-980f4c8fcb05 | 2 | public ZFrame pop() {
if (frames == null)
frames = new ArrayDeque<ZFrame>();
try {
return frames.pop();
} catch (NoSuchElementException e) {
return null;
}
} |
91c47a55-6333-4313-bb6d-5082a89b8409 | 3 | private String stackTraceString(Exception e){
StringWriter stackString = new StringWriter();
int depth = 0;
for(StackTraceElement element : e.getStackTrace()){
stackString.write("\t");
for (int i = 0 ; i <= depth ; i++){
stackString.write(" ");
}
stackString.write(element.getClassName() + ":" + ... |
e0567eeb-9157-4276-ad65-2fffe74a8288 | 0 | public void setVerdes(int verdes) {
this.verdes = verdes;
} |
a6e4f133-9daf-4f0b-9ebe-b0ef11cb4c1e | 3 | static double[][] inverse(double[][] A){
double[][] B;
double detA = det(A);
if(A.length == 1){
B = new double[1][1];
B[0][0] = 1/detA;
}else{
B = new double[A.length][A.length];
B = transpose(cofactor(A));
for(int i = 0; i < B.length; i++){
for(int j = 0; j < B.length; j++){
B[i][j] = B... |
38fe65bc-bc41-4d14-b2de-5ad5e633608c | 9 | public void cambiarCasilla(Casilla casilla, int type){
if(type != 7 && type != 5 && type != 6)
porcentajeObstaculos = (float) (porcentajeObstaculos + (100.0 / ((float) size_tablero_F * (float) size_tablero_C)));
if( (type == 7 || type == 5 || type == 6) && casilla.get_type() != 7 && casilla.get_t... |
e7625b8d-520d-4b47-8e29-32a14c1ba845 | 2 | @Override
public void show_PortA(Integer value) {
PIC_Logger.logger.info("Showing Port A");
int x=7;
for(int i = 0; i < 8; i++){
if( (value & (int)Math.pow(2, i)) == (int)Math.pow(2, i)){
regA.setValueAt(1, 1, x+1);
}
else{
regA.setValueAt(0, 1, x+1);
}
x--;
}
} |
8619a934-d244-4fb0-8595-38d03864e9a8 | 3 | void createChildWidgets() {
/* Add common controls */
super.createChildWidgets();
/* Add TableEditors */
comboEditor = new TableEditor(table);
nameEditor = new TableEditor(table);
table.addMouseListener (new MouseAdapter() {
public void mouseDown(MouseEvent e) {
resetEditors();
index = table... |
ce4b1f30-ade1-40cb-ac4f-5663452cbff2 | 6 | public List<String> anagrams(String[] strs) {
List<String> result = new ArrayList<String>();
if (strs == null || strs.length == 0)
return result;
Map<String, List<String>> map = new HashMap<String, List<String>>();
for (String str : strs) {
char[] strChars = str.toCharArray();
Arrays.sort(strChars);
... |
55f44b11-621f-43d0-9c64-b125985121db | 7 | private JPopupMenu getTabsPopupMenu() {
JPopupMenu popup = new JPopupMenu("Tabs");
// Tabs -> Part
JMenuItem menuItemPart = new JMenuItem("Part");
menuItemPart.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Component component = getSelectedCom... |
34bbac6d-3ea8-496b-889d-9661d03b8feb | 9 | private int validateInsert()
{
try
{
int receiptID;
int upc;
int quantity;
if (returnID.getText().trim().length() != 0 && isNumeric(returnID.getText().trim()))
{
receiptID = Integer.valueOf(returnID.getText().trim()).intValue();
} else {
return VALIDATIONERROR;
}
if (itemU... |
8a59c8a5-b72f-41ec-b05d-b5e2b580a7b9 | 3 | public Boolean readBit() throws IOException{
if(buffer==-1)
return null;
if(bufferFilled==0){
buffer = in.read();
if(buffer==-1)
return null;
bufferFilled = 7;
}
else
bufferFilled--;
boolean ret = (buffer&128)>0;
buffer<<=1;
return ret;
} |
a8a0eed7-1b66-43b1-8a19-e2742e7eb030 | 3 | protected void buildIntervals(IntervalsBuilder<T> builder) {
// go throug map and create intervals as numbers goes
for (Iterator<Map.Entry<T, Boolean>> it = setMap.entrySet().iterator(); it.hasNext();) {
Map.Entry<T, Boolean> object = it.next();
// start
if (object.ge... |
f3014ac2-26a7-4f36-9ec0-20ded65896fe | 5 | @EventHandler(priority = EventPriority.LOWEST)
public void onEnchantAttempt(PrepareItemEnchantEvent e) {
final World world = e.getEnchantBlock().getWorld();
for (String worldname : WorldSettings.worlds) {
if (Settings.world || world.getName() == worldname) {
if (Settings.totalenchant
&& !PermissionHan... |
b3954998-62cb-4f74-b296-5d350c9eb76a | 8 | public byte[] CreateAnswerPacket(byte[] Qpacket,String adrr){
System.out.println("Le packet QUERY recu");
for(int i = 0;i < Qpacket.length;i++){
if(i%16 == 0){
System.out.println("\r");
}
System.out.print(Integer.toHexString(Qpacket[i] & 0xff).toString() + " ");
}
System.out.println("\r");... |
c1600326-14c0-4110-beb8-54e88b0cb419 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final XML other = (XML) obj;
if (this.document != other.document && (this.document == null || !this.document.eq... |
ca2dacc8-1477-4bb0-b14d-e8a8c04a5650 | 1 | public void unlockProgrammProcess() {
try {
programLocker.close();
new File(VCNConstants.LOCK_FILE_PATH).delete();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Program lock released");
} |
8acc2065-e139-4777-98e9-c0080062f01e | 1 | private boolean isFirst(){ //todo 2 regime
if (gameRegime != TWO_PLAYERS_ONLINE_GAME_REGIME){
return true;
} else {
System.out.println("Are you first to play?");
... |
085e0421-dc9f-4bc8-af23-7e49b390ef3d | 6 | private void randomSolve()
{
Log.log("RandomSolve <Start>");
collectAreas(true);
if ( !mAreas.isEmpty())
{
double prop = 0;
Area maxArea = null;
for (Area area : mAreas)
if ( !area.isToRemove() && (maxArea == null || area.getProbability() > prop))
{
maxArea = area;
prop = maxArea.get... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.