method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c744f495-0e8c-4a36-befe-2b23ee12a7dc | 8 | protected void initVerifiers(int currVerSet) {
int idx = 0 ;
int currVerifierSet ;
if (currVerSet >=0 && currVerSet < NO_OF_LANGUAGES ) {
currVerifierSet = currVerSet ;
}
else {
currVerifierSet = nsPSMDetector.ALL ;
}
mVerifier = null ;
mStatisticsData = null ;
if ( currVerifierSet == nsPSMD... |
213da910-3405-42f9-8473-34f32bc8e060 | 3 | private static FeatNode getNode(Long parentId, Long featId) {
if (containedFeats.contains(featId)) {
for (FeatNode n : nodes.values()) {
if (n.getFeat() == featId) {
nodes.get(n.getId()).getParents().add(parentId);
System.out.println("Node retu... |
89e26c2b-5ecb-4c90-a66a-16fe78a23e05 | 5 | private String randomResource(int i) {
String resource; // String ressource a retourner
// Affecte la string ressource au cas par cas en fonction de la valeur de l'entier.
switch (i) {
case 0:
resource = "bois";
break;
case 1:
resource = "mouton";
break;
case 2:
resource = "ble";
... |
275d5e59-0147-4e37-97ee-f1bdb650d56e | 3 | public static String trimLeadingCharacter(String str, char leadingCharacter) {
if (!hasLength(str)) {
return str;
}
StringBuilder sb = new StringBuilder(str);
while (sb.length() > 0 && sb.charAt(0) == leadingCharacter) {
sb.deleteCharAt(0);
}
return sb.toString();
} |
82ef3807-9249-4a3c-a1ab-4821146e4f20 | 5 | public DetailedEditor(final Display display, final List<String> headerList,
final CSVRow row, String inCellDelimiter, String regexTableMarker) {
shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setText("Detailed CSV edition");
shell.setSize(800, 600);
// If there is more columns for ... |
fc490e86-3017-46d7-a672-917f61ccb4ea | 3 | static public boolean deleteDirectory(File path) {
if (path == null) return false;
try {
if( path.exists() ) {
Functions.clearDirectory(path);
}
return( path.delete() );
} catch (Throwable e) {
return false;
}
} |
1fdf3133-b5c6-4537-a5ec-95249cf94558 | 3 | public synchronized void run() {
// go over all complete messages and process them.
while (_tokenizer.hasMessage()) {
String msg = _tokenizer.nextMessage();
String response = this._protocol.processMessage(msg);
if (response != null) {
try {
ByteBuffer by... |
ba742875-977d-43e8-9c94-20cd8b118f54 | 8 | public boolean readFile(String filename, int k, BookmarkReader wikiReader, Integer minBookmarks, Integer maxBookmarks, Integer minResBookmarks, Integer maxResBookmarks) {
try {
this.filename = filename;
FileReader reader = new FileReader(new File("./data/results/" + filename + ".txt"));
BufferedReader br = n... |
cc9c9300-f557-474f-ba06-8bc5e4597373 | 1 | public void testDividedBy_int() {
Years test = Years.years(12);
assertEquals(6, test.dividedBy(2).getYears());
assertEquals(12, test.getYears());
assertEquals(4, test.dividedBy(3).getYears());
assertEquals(3, test.dividedBy(4).getYears());
assertEquals(2, test.dividedBy(5... |
d82fc27b-f037-4e8c-9d04-0d013746efe8 | 3 | protected void toString2(StringBuffer sbuf) {
super.toString2(sbuf);
sbuf.append(",\n stack={");
printTypes(sbuf, stackTop, stackTypes);
sbuf.append("}, locals={");
printTypes(sbuf, numLocals, localsTypes);
sbuf.append("}, inputs={");
if (inputs != null)
... |
ff80ad1a-608e-465b-8a6c-fc71f8da1e22 | 8 | public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... |
e6d6667c-164a-4e92-827b-d12cda62f3dd | 3 | public void actionPerformed(ActionEvent ev)
{
try
{
AreaFormacao objt = classeView();
if (obj == null)
{
long x = new AreaFormacaoDAO().inserir(objt);
objt.setId(x);
JOptionPane.showMessageDialog(null,
"Os dados foram inseridos com sucesso", "Sucesso", JOptionPane.INFORMATION_MESSAGE);
... |
787bd628-9f5d-4821-a9e8-5a6bdb5eb07e | 4 | @EventHandler
public void onItemSpawn(ItemSpawnEvent event)
{
SpoutBlock Block = (SpoutBlock) event.getLocation().getBlock();
Location loc = Block.getLocation();
loc.add(0, 1, 0);
SpoutBlock BlockAbove = (SpoutBlock) loc.getBlock();
CustomBlock CustomBlock = Block.getCustomBlock();
CustomBlock CustomBl... |
29d3f20d-1342-4cdb-8a6e-376c922c8d57 | 7 | public void setLoadOnDemand() {
if (loadOnDemand)
return;
loadOnDemand = true;
if ((Main.stripping & Main.STRIP_UNREACH) == 0) {
String fullNamePrefix = (fullName.length() > 0) ? fullName + "."
: "";
// Load all classes and packages now, so they don't get stripped
Enumeration enum_ = ClassInfo.g... |
76c6f796-4239-479e-bf9f-ee77761f28c1 | 2 | @Test
public void testOutputContacts() throws IOException {
cm.addFutureMeeting(contacts, new GregorianCalendar(2015,3,2));
cm.addNewPastMeeting(contacts, new GregorianCalendar(2013,5,3), "meeting");
cm.flush();
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("contacts.txt"));
List inputDat... |
aa258bbe-d6b9-46c0-a470-079b218551d3 | 9 | public void run() {
RUNNING = true;
try {
notifier.setTimeCounter(notifier.getTimeCounter() - 1);
if (notifier.getTimeCounter() <= 0 && notifier.getOutputQ().size() > 0) {
List<EventBean> batch = new ArrayList<EventBean>();
notifier.getOutputQ().... |
0791f4b6-777f-450c-9e4f-f20faaa5edcd | 2 | public void run() {
try {
while (this.dispatch()) {}
System.out.println("Finished queue");
} catch (IOException ex) {
Logger.getLogger(Queue.class.getName()).log(Level.SEVERE, null, ex);
}
} |
e82cd260-6da1-465f-a3ad-7a067fe3090f | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result
+ ((lastName == null) ? 0 : lastName.hashCode());
result = prime * result
+ ((patronymic == null) ? 0 : patronymic.hashCode()... |
d158e304-329e-4a4a-807d-52597ef53274 | 9 | public StorageDevice(String device) throws DBusException {
this.device = device;
boolean isOpticalDisc = false;
String connectionInterface = null;
/*
* The Udisks2 interface "Drive" reports *all* USB drives as removable,
* even those where /sys/block/[device]/removable... |
9ffbb972-624c-4e6a-b8e4-1729fe0a1740 | 0 | public int GetBusCapacity()
{
//get the capacity of the bus
return busCapacity;
} |
e7a5458a-ec0a-422a-880c-e684f7342b8b | 7 | public void sortColors(int[] nums) {
int red = 0, white = 0, blue = 0;
for (int i=0; i<nums.length; i++) {
int j = nums[i];
if (j == 0)
red = red+1;
if (j == 1)
white = white + 1;
if (j == 2)
blue = blue + 1;... |
940b3741-20d5-45d7-bc94-35598eab3330 | 1 | public void addPatient(Patient newPatient){
if (this.nextPatient == null){
this.nextPatient = newPatient;
} else {
this.nextPatient.addPatient(newPatient);
}
} |
b49a25ea-5eaa-4769-9134-07febb090c06 | 6 | protected void moveMinecartOnRail(int i, int j, int k)
{
int id = worldObj.getBlockId(i, j, k);
if (!BlockRail.isRailBlock(id))
{
return;
}
float railMaxSpeed = ((BlockRail)Block.blocksList[id]).getRailMaxSpeed(worldObj, this, i, j, k);
double maxSpe... |
299f7dac-f171-458c-8364-f033dbdc15ae | 8 | public String adding(String field, int min, int max)
{
String newField = "";
for(int i = 1; i <= field.length(); i++)
{
if(isNumber(field.substring(i - 1, i)))
{
newField = newField + field.substring(i - 1, i);
}
else
... |
29642201-4049-4bb3-9b58-36c32b1917ad | 5 | public static void main(String[] args)
{
try {
PerlinGenerator perlin = new PerlinGenerator(new RNG(),100);
Display.setDisplayMode(new DisplayMode(1000,1000));
Display.create();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, Display.getDisplayMode().getWidth(), Displa... |
7a1a81ac-17c2-42c5-a2bd-1d3fdce7e7f0 | 6 | public static void main(String args[]) {
try {
System.out.println("RS2 user client - release #" + 317);
if (args.length != 5) {
System.out.println("Usage: node-id, port-offset, [lowmem/highmem], [free/members], storeid");
return;
}
... |
1dccbdaa-3a79-49cb-8805-66d186197255 | 2 | public int getIntelligence(){
int value = 0;
for (Armor armor : armorList) {
if(armor != null) value += armor.getStats().getIntelligence();
}
return value;
} |
80eae7c5-6142-4afe-8434-766d0afe1d3a | 1 | public void removeActionListener(ActionListener l) {
if(l == null) {
return;
}
actionListener = null;
} |
80cbc7d3-006a-4b1c-8a18-6e35d89e9419 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
d0fd5b97-9b1d-483a-9c3a-c1c1b7a90d83 | 7 | public static IList<Integer> merge(IList<Integer> l1, IList<Integer> l2) {
// If one of the two lists is empty return the other one
if (l1.isempty())
return l2;
if (l2.isempty())
return l1;
IList<Integer> merged = new MLinkedList<Integer>();
// Get the first Node as node object from both lists
INode... |
801a94d2-1bf1-45f9-bf69-6696c52fe4f9 | 8 | public static void main(String[] args) {
if(true || true){
System.out.println(1);
}
if(true || false){
System.out.println(2);
}
if(false || true){
System.out.println(3);
}
if(false || false){
System.out.println(4);
}
} |
832764f3-6c55-45a3-91e0-f9c8da88631e | 9 | private int getNeighbours(int x, int y) {
int nNeighbours = 0;
for (int deltaX = -1; deltaX <= 1; deltaX++) {
int nextX = x + deltaX;
if (nextX == width) {
// nextX = 0;
continue;
} else if (nextX < 0) {
// nextX = width - 1;
continue;
}
for (int deltaY = -1; deltaY <= 1; deltaY++) {... |
86d83835-51f2-4e85-88b1-9f2a1a95a194 | 1 | public void testCoherence() {
LinkedElement<E> elemf = first;
LinkedElement<E> elemb = last;
for (int i = 1; i < total; i++) {
System.out.println(elemf + "\t| " + elemb);
elemf = elemf.getNext();
elemb = elemb.getPrev();
}
System.out.println(elemf + "\t| " + elemb);
System.out.println("LL Coheren... |
b3e49a88-84c4-4690-b8f3-a994cad8c1ca | 8 | void prepareData() {
int numPoints = Math.min(MAX_DATA_POINTS, x.length);
if( x.length > numPoints ) subsample(numPoints);
// Find min & max values
minX = Double.MAX_VALUE;
maxX = Double.MIN_VALUE;
minY = Double.MAX_VALUE;
maxY = Double.MIN_VALUE;
for( int i = 0; (i < x.length) && (i < numPoints); i++... |
b9960f31-c0ee-4976-89a7-4c1ae0f2fdf5 | 3 | public static String getConstructorDescriptor(final Constructor<?> c) {
Class<?>[] parameters = c.getParameterTypes();
StringBuffer buf = new StringBuffer();
buf.append('(');
for (int i = 0; i < parameters.length; ++i) {
getDescriptor(buf, parameters[i]);
}
re... |
369d3838-965e-4b88-861a-465dcd53a7b5 | 8 | public byte read() {
int value = 0;
value |= pins[0].read() ? 1 << 0 : 0;
value |= pins[1].read() ? 1 << 1 : 0;
value |= pins[2].read() ? 1 << 2 : 0;
value |= pins[3].read() ? 1 << 3 : 0;
value |= pins[4].read() ? 1 << 4 : 0;
value |= p... |
e173ecd0-11a1-4fe4-a7a1-baeb0b23f3fe | 6 | private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
//Set window properties
this.setLocationRelativeTo(null);
this.setIconImage(Resources.getImageResource("icon.png").getImage());
popupDialog.setIconImage(Resources.getImageResource("icon.png"... |
3557bf70-2869-4508-9542-ff14d38d6981 | 4 | @Override
public boolean equals(Object obj) {
if(obj == null || !(obj instanceof Triangle)) {
return false;
}
return this.side1.compareTo(((Triangle)obj).getSide1()) == 0
&& this.side2.compareTo(((Triangle)obj).getSide2()) == 0
&& this.side3.compareTo(((Triangle)obj).getSide3()) == 0;
} |
a54dcc0a-af88-4587-acad-616efee76c5b | 4 | public static void main(String[] args) {
Config.load();
String driver = "com.mysql.jdbc.Driver";
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(Config.db_host+Config.db_db, Config.db_user, Config.db_password);
GameQu... |
10557d09-12e3-4ac5-b7b1-57b9f42bf712 | 4 | protected boolean isLastSignMathExpression()
{
return lastCharacter().equals("*") || lastCharacter().equals("/")
|| lastCharacter().equals("+") || lastCharacter().equals("-")
|| lastCharacter().equals("^");
} |
f2e02f19-245d-4836-a71d-ffe899aa332c | 5 | public void destroy(String filename) throws Exception {
int fileDescriptorIndex = findIndexOfFileDescriptor(filename,true);
for(int i = 0; i < oft.index.length; i++) {
if (oft.index[i] == fileDescriptorIndex) {
System.out.println("Closing before destroying: " + i);
close(i);
}
}
FileDescripto... |
453146d1-1c11-46f3-8afd-d48d6abcd0f5 | 6 | public ArrayList<Airport> searchAirport(String searchString) {
ArrayList<Airport> result = new ArrayList<Airport>();
for (Airport a : getAirports()) {
if (a.getCity().contains(searchString)) {
result.add(a);
} else if (a.getCountry().getCountry().contains(searchS... |
c6e55d4a-df5b-4d93-a702-62759245bf05 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
e266c02f-23a0-401c-b5bb-4c7390d48de1 | 5 | public void play() {
long no = 1;
try {
while (true) {
if (1 == (no % 2)) {
JchessEntity jchess = new JchessEntity(data.generate(1));
Command cmd = player1.play(jchess);
if (cmd.isGiveup()) {
throw new CommandException(1, "܂B");
}
data.command(1, cmd);
} else {
Jches... |
67dbe226-e53f-414d-b95a-3d840569b9b6 | 1 | public FieldAnalyzer(ClassAnalyzer cla, FieldInfo fd, ImportHandler i) {
clazz = cla;
imports = i;
modifiers = fd.getModifiers();
type = Type.tType(fd.getType());
fieldName = fd.getName();
constant = null;
this.isSynthetic = fd.isSynthetic();
this.isDeprecated = fd.isDeprecated();
if (fd.getConstant(... |
46afeea4-69be-4122-8e7a-04fbcb8b651a | 4 | final void instrument(final Map<Integer, Set<Instrument>> instruments) {
int countTotal = 0;
for (final Set<Instrument> is : instruments.values()) {
for (final Instrument i : is) {
if (i.uniqueIdx()) {
final Integer countOld = this.countMap.get(i.type());
if (countOld == null) {
this.countMap... |
79a51776-0889-4f76-a2e6-c976fea56e21 | 0 | @Override
public String toString()
{
return "Item ID: \t" + iD + "\nName: \t\t" + name + "\nRange: \t\t" + minRange + "~" + maxRange + "\nAtt/M.Att: \t" + atk + "/" + mAtk + "\nAccuracy: \t" + acc + "\nCritical: \t" + crit + "\nSale Price: \t" + value;
} |
4726c934-8caf-4161-98a0-c85cf343a743 | 1 | protected static String parseAsBooleanString(String[] args) {
return parseAsBoolean(args)? Argument.argTrue:Argument.argFalse;
} |
d9408ed7-33b0-44aa-942f-0e46384e7489 | 4 | public static void readSort() {
try {
File file = new File("data/sort.txt");
if (file.isFile() && file.exists()) {
InputStreamReader read = new InputStreamReader(
new FileInputStream(file));
BufferedReader bufferedReader = new BufferedReader(read);
String lineTxt = null;
while ((lineTxt = ... |
d4e70328-e178-4b6e-9d10-4065abb0a22b | 5 | public static int[] selection(int[] array) {
if(array==null || array.length==0) return array;
int minIndex;
int tmp;
int cnt=0;
for(int i=0;i<array.length;++i) {
minIndex = i;
for(int j=i;j<array.length;++j) {
cnt++;
if(array[minIndex]>array[j]) minIndex=j;
}
tmp = array[i];
array[i]=ar... |
13298426-3232-446f-b050-c293f8e49c93 | 4 | public Prime(int n) {
max = n;
bitSet = new BitSet(max + 1);
if (max > 1){
bitSet.set(0, 2, false);
bitSet.set(2, max + 1, true);
for (long i = 2; i * i <= max; ++i) {
if (isPrime((int) i)) {
for (long j = i * i; j <= max; j += i) {
bitSet.set((int) j, false);... |
7c0f7513-034c-4f9e-86ce-7824110c3c99 | 2 | @Override
public Auction bid(String username, int itemId) {
searches.get(searches.get(itemId));
for(Auction auc : searches.values()){
if(searches.get(itemId) != null){
auc.setCurrentBid(auc.getCurrentBid()+1);
// auc.currentBid++;
auc.setOwner(username);
return auc;
}
}
return null;
} |
6f34af14-1ade-41fa-adaf-ebd453482031 | 0 | public CarBuilder setElectricBrakes(boolean electricBrakes) {
delegate.setElectricBrakes(electricBrakes);
return this;
} |
4433686b-5c02-4e05-ab6c-db75692c981c | 0 | public static void main(String[] args) {
// Teste de repositorio
// Teste 1100912
} |
0d78f792-d81d-406c-9629-3a0729fbf854 | 1 | public Tile getTile(int i) {
try {
return tiles.get(i);
} catch (ArrayIndexOutOfBoundsException a) {}
return null;
} |
304b5b2f-4322-4d01-aade-3bcad52622f3 | 0 | public Gameplay(AntBrain red, AntBrain black) {
this.world = new World();
this.random = new RandomInt();
this.rand = new Random();
this.redFood = 0;
this.blackFood = 0;
this.redAntBrain = red;
this.blackAntBrain = black;
this.ants = new ArrayList<>();
... |
9ab8d04e-3ab6-4bc0-b982-761ad090b606 | 1 | public static String mksmiley(String str) {
synchronized (smileys) {
for (Pattern p : Config.smileys.keySet()) {
String res = Config.smileys.get(p);
str = p.matcher(str).replaceAll(res);
}
}
return str;
} |
b65a7468-944a-4407-837a-3c9237355a22 | 7 | private void scanContainer(DockEvent event, boolean drop) {
Point p = event.getMouseEvent().getPoint();
Rectangle compBounds = getBounds();
int distTop = p.y;
int distLeft = p.x;
int min = Math.min(distTop, distLeft);
int distRight = compBounds.width - p.x;
int distBottom = compBounds.height - p.y;
int ... |
f6cfa62d-97bc-43ce-a53d-e9652a77d90d | 9 | public void run() {
updateScreen();
try {
while ((inputLine = in.readLine()) != null) {
if (inputLine.startsWith("DN")) {
// TODO
}
else if (inputLine.startsWith("D")) {
if (inputLine.equals("D"))
sim.setDisplayText("");
else
sim.setDisplayText(inputLine.substring(2, inp... |
9e3d084d-dc18-4195-a5d2-034ce0e23276 | 2 | public void removeImage(String name) {
if (IMAGE_URLS.containsKey(name)) IMAGE_URLS.remove(name);
if (IMAGES.containsKey(name)) IMAGES.remove(name);
} |
2c115ae8-d27b-47f9-a4d8-28cb73ada742 | 2 | public JSONObject putOpt(String key, Object value) throws JSONException {
if (key != null && value != null) {
put(key, value);
}
return this;
} |
bf4f71a2-5178-4e41-aa65-7177e281ae70 | 5 | public Object getValueAt(int indiceLigne, int indiceColonne){
//System.out.println("ModeleListeVehicules::getValueAt()") ;
switch(indiceColonne){
case 0 :
return vehicules.get(indiceLigne).getImmatriculation() ;
case 1 :
return vehicules.get(indiceLigne).getModele() ;
case 2 :
return vehicule... |
c2fdf501-5fd1-483e-b572-4dc58acfab27 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int n = to.length();
char[] circle = new char[n];
/*
* First fill the circle buffer with as many characters as are in the
* to string. If we... |
9ab20d02-3959-4b5c-bc84-b0e8067ca0e3 | 1 | public CallExpr(final Expr[] params, final MemberRef method, final Type type) {
super(type);
this.params = params;
this.method = method;
for (int i = 0; i < params.length; i++) {
params[i].setParent(this);
}
} |
931f6206-99bc-41a6-a7a2-e87e8772cbdb | 5 | public static void saveAs(Skin skin, String newName) {
if ((skin != null) && (model != null) && (newName != null) && !newName.equals("")) {
if (!model.saveAsSkinToDefaultDirectory(skin, newName)) {
showProblemMessage("Main.saveAs: Skin was not saved!");
}
} else {... |
b949fa82-e473-49b7-9019-c43c6270ccd3 | 4 | protected static Ptg calcAnd( Ptg[] operands )
{
boolean b = true;
Ptg[] alloperands = PtgCalculator.getAllComponents( operands );
for( Ptg alloperand : alloperands )
{
if( alloperand instanceof PtgBool )
{
PtgBool bo = (PtgBool) alloperand;
Boolean bool = (Boolean) bo.getValue();
if( bool ==... |
224db571-1b63-4190-8c2a-9769626a4091 | 1 | public void addSlug(String slug) {
if (this.slugs == null) {
this.slugs = new ArrayList<String>();
this.slugs.add(slug);
} else {
this.slugs.add(slug);
}
} |
ce9980e5-9726-485d-904b-243f355df86a | 8 | public void method390(int i, int j, String s, int k, int i1)
{
if(s == null)
return;
aRandom1498.setSeed(k);
int j1 = 192 + (aRandom1498.nextInt() & 0x1f);
i1 -= anInt1497;
for(int k1 = 0; k1 < s.length(); k1++)
if(s.charAt(k1) == '@' && k1 + 4 < s.length() && s.charAt(k1 + 4) == '@')
{
int l1 = getColorB... |
8020d03d-7c94-4b2f-ab53-25e6cb628195 | 7 | @SuppressWarnings({ "unchecked" })
private boolean load() {
log.info("Loading config file \"" + configDir.getPath(configPath) + "\"");
Object obj;
ObjectInputStream os = null;
try {
try {
os = new ObjectInputStream(configDir.readFile(configPath));
} catch (IOException e) {
log.err("... |
56261250-90e3-4a78-9bef-c7ec066f0477 | 2 | public Creature(int locx, int locy, String spriteFile) {
if(getSprite() == null){
try {
setSprite(ImageIO.read(new File(spriteFile)));
} catch (IOException e) {
e.printStackTrace();
}
}
x = locx;
y = locy;
stats = new Attributes(new int[]{5,5,5,5,5,5});
} |
7189f9eb-7f45-4d3a-803e-cbeb47c2c286 | 3 | public static boolean available(int port) {
ServerSocket ss = null;
try {
ss = new ServerSocket(port);
ss.setReuseAddress(true);
return true;
} catch (IOException e) {
} finally {
if (ss != null) {
try {
... |
7bcf9975-eeda-4bf4-bf4d-67fd7f4fa803 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RecordSelectorNode other = (RecordSelectorNode) obj;
if (selector == null) {
... |
41b2fa99-32ec-415b-917d-c45eeb13d21c | 9 | public boolean pawnCapturing(int x1, int y1, int x2, int y2, String color, Square newSquare)
{
boolean capture = false;
if(color == "White")
{
if( (((x2 == x1 + PAWN_MOVEMENT_RESTRICTION) || (x2 == x1 - PAWN_MOVEMENT_RESTRICTION)) && y2 == y1 + PAWN_MOVEMENT_RESTRICTION)
&& newSquare.getPiece().getPiec... |
75a04a0c-0880-42d0-8115-a4fce7ce99a6 | 1 | private static void readFile() {
while (scanner.hasNext()) {
lines.insert(scanner.nextLine());
}
} |
0d3b2b78-7ca2-4721-a3b0-02eccc3cc805 | 0 | public Boolean isDeleted() {
return isDeleted;
} |
78446c14-083d-4364-b158-a345b6a4ecca | 0 | public TotalPane() {
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.setBorder(new TitledBorder("总流量统计"));
container.setLayout(new GridLayout(3, 2));
container.add(totaltitle);
totalnum.setText("43349");
container.add(totalnum);
container.add(tcptitle);
... |
ca436c8a-4fd2-4fff-84a4-8840527d021e | 2 | @Override
public String processCommand(String[] arguments)
throws SystemCommandException {
String electionID = arguments[0];
facade.setCurrentElection(electionID);
Election election = facade.getCurrentElection();
if (election == null || !election.getEID().equals(electionID)){
throw new Sy... |
63983a5f-41eb-4ae5-900e-85cf22f069a4 | 7 | @RequestMapping( ApplicationConstants.CREATE_USR)
@ResponseBody
public Object createUser(@RequestParam("name") String name,
@RequestParam("email") String email,
@RequestParam("password") String password) {
User user=new User();
Map<Object,String> errorMap=new HashMap<Object, String>();... |
18215cb6-7314-47d9-afb7-599e2b0b971b | 0 | public BufferedReader getBufferedReader() {
return _reader;
} |
13f34031-17cb-40e9-83a5-5e44fa861075 | 0 | private EndPoint getEndPoint() {
return endPoint;
} |
3339f4ca-957f-4685-9dda-600ff7fdffc5 | 8 | public int findMaxIndexDifferenceOrdering(int[] a) {
lMin = new int[a.length];
lMax = new int[a.length];
/* Keep track on MIN element until position i */
lMin[0] = a[0];
for (int i = 1; i < a.length; i++) {
if (a[i] < lMin[i - 1]) {
lMin[i] = a[i];
} else {
lMin[i] = lMin[i - 1];
}
}
/... |
560869ce-353b-4c1b-b108-f0bbbdcd385a | 6 | public Transition transitionCreate(State from, State to) {
if (currentStep == TRANSITIONS_TO_SINGLE_FINAL) {
if (automaton.getFinalStates()[0] != to) {
JOptionPane.showMessageDialog(frame,
"Transitions must go to the new final state!",
"Bad Destination", JOptionPane.ERROR_MESSAGE);
return null;... |
07de77fd-3758-48d5-9217-8f1b64bbda05 | 9 | public void solve(){
int timeoutCell = 40;
int timeoutGroup = 20;
ArrayList<Thread> allThreads = new ArrayList<Thread>();
for (int i=0; i < 81; i++){
int[] xy = indexToXY(i);
int x = xy[0];
int y = xy[1];
SudokuCellThread thread = ... |
f0da5cc2-a68a-46a9-8dfe-2a45eadffa04 | 8 | private void startInputMonitor(){
while(noStopRequested){
try{
//this.processRegisteAndOps();// 处理通道监听注册和读取事件注册
int num = 0;
//this.selector.selectedKeys().clear();// 清除所有key
// Wait for an event one of the registered channels
num = this.selector.select(50);
//num = t... |
efef3929-00cd-4e41-bc77-6f902a9867e1 | 2 | @Override
public void endTurn() {
if (cooldown > 0) {
cooldown--;
if (cooldown == 0) {
tile = startingPosition;
tile.addBomber(this);
}
//other end-of-turn actions not possible if still dead.
}
} |
19085b2e-131a-49d6-8b04-4ea9b28eb49f | 1 | private boolean jj_3R_73() {
if (jj_3R_49()) return true;
return false;
} |
208b2964-1532-4968-85cc-be633aa85286 | 7 | private boolean handleWithoutQueueing(final DataTelegram telegram) {
if(_mode == HANDLE_CONFIG_RESPONCES_MODE) {
if(telegram.getType() == DataTelegram.APPLICATION_DATA_TELEGRAM_TYPE) {
ApplicationDataTelegram applicationDataTelegram = (ApplicationDataTelegram)telegram;
BaseSubscriptionInfo info = appli... |
b94c7983-7955-4eef-bef3-145446c9af60 | 1 | public boolean meleeHitDetection(int enemyPosX, int enemyPosY){
double distance = Math.sqrt( (enemyPosX-posX)*(enemyPosX-posX) + (enemyPosY-posY)*(enemyPosY-posY) );
if(distance<50){//50=meleerange
return true;
}else{
return false;
}
} |
af1cbdbe-d9e9-45bf-b18a-898f39dc25ee | 6 | public static String getHost(String url){
if(url == null || url.length() == 0)
return "";
int doubleslash = url.indexOf("//");
if(doubleslash == -1)
doubleslash = 0;
else
doubleslash += 2;
int end = url.indexOf('/', doubleslash);
end = ... |
f24f6783-fd0c-4934-8673-f742a62619ac | 2 | public Class getTypeClass() throws ClassNotFoundException {
if (topType.isClassType() || !bottomType.isValidType())
return topType.getTypeClass();
else
return bottomType.getTypeClass();
} |
36a84ff9-0504-4775-82df-0944ed0d7daf | 7 | public String getAlbumArtURL() {
String Albumarturl = null;
int length = getAlbumID().length();
switch (length) {
case 1:
Albumarturl = "http://image.melon.co.kr/cm/album/images/000/00/00" + getAlbumID().substring(0, 1) + "/" + getAlbumID() + "_500.jpg";
... |
ebe4bd34-af27-42a3-8722-f8b845070454 | 1 | public int getHandCount(){
int total=0;
for (int i=0;i<hand.size();i++)
total+=hand.get(i).getValue21();
return total;
} |
0a2f2731-07a4-4959-a504-718e3e741eea | 3 | public static List<Element> mergeSort(List<Element> list) {
if (list.size() <= 1) {
return list;
}
// Make two arrays for range < pivot && range > pivot
List<Element> left = new ArrayList<Element>();
List<Element> right = new ArrayList<Element>();
int middle ... |
931832de-1f44-4a7f-af56-e5cf9e573a75 | 9 | private void importFiles() {
TreeItem[] selection = tree.getSelection();
if (selection.length != 1)
return;
TreeItem cur = selection[0];
while (cur != null && !(cur.getData() instanceof Project))
cur = cur.getParentItem();
if (cur == null)
return;
Project proj = (Project) cur.getData();
FileD... |
3bdc9268-8c0e-4eb9-a283-e1fef69e202b | 6 | public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception
{
HashMap<String, HashMap<String, Integer>> map =
new HashMap<String, HashMap<String,Integer>>();
BufferedReader reader = filePath.toLowerCase().endsWith("gz") ?
new BufferedReader(new InputStreamReader(
... |
41524257-8260-44da-afc8-6296431cf06b | 6 | public void spawnEnemies(){
int startPositionX = (rd.nextInt(Math.abs(settings.screenWidth - 40)));
int startPositionY = rd.nextInt(350);
int checker = rd.nextInt(2000);
if(checker < 10){
for(int i = 0; i < munchkins.length; i++){
if(munchkins[i] == null){
munchkins[i] = new Mun... |
a2c1df1b-a7ab-480c-aeae-e001bf81842a | 0 | public void keyReleased(KeyEvent e) {
} |
aefeab83-62e2-4fa6-8d51-917fae4fd9f3 | 6 | private void assignBlood(int x, int y){
if (x>9)
x = x-10;
else if (x<0)
x = 10+x;
if (y>9)
y = y-10;
else if (y<0)
y = 10+y;
if (grid[x][y]==RoomState.EMPTY)
grid[x][y] = RoomState.BLOOD;
else if (grid[x][y]==RoomState.SLIME)
grid[x][y] = RoomState.GOOP;
} |
ad55b481-4bc2-4e48-a8bf-3529723c828d | 7 | public void parser() throws Exception {
Connection conn = JDBC.createConnection();
Ngram ngram;
int count = 0;
Token pre = new Token(null, null);
String preWordWithAttr = null;
// for (int i = 0; i < 10; i++)
// list = lexer.nextTokenList();
while (list != null) {
System.out.println("sss" + lis... |
34eac7ce-7ad5-4dff-96a6-ce96e91126cf | 2 | synchronized public boolean accederAuTrain (Voyageurs voyageur, Train train) {
Iterator<Train> iteratrain = listeTrainQuai.iterator();
while (iteratrain.hasNext()) {
Train trainListe = iteratrain.next();
if (trainListe.equals(train)) {
train.embarquer(voyageur);... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.