method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
431d5efb-116d-4786-b5f2-a8d803c7626b | 3 | public AcceptedConnectionThread(Socket clientSocket) {
this.clientSocket = clientSocket;
try {
input = new ObjectInputStream(clientSocket.getInputStream());
// the first message sent by the client is its application
// address
senderAddress = (Address) input.readObject();
if (verbose) {
S... |
15e62614-bed6-40bd-bac8-fb2811b0696a | 7 | public void motionDetected(double cX, double cY, double area) {
if (
this.controller.getCamState().getCamSpeedX() == 0
&& this.controller.getCamState().getCamSpeedY() == 0
) {
Point2D motion = this.camPosToAbsPos(new Point2D(cX, cY));
Body closest = null;
this.controller.getRoomState().lo... |
ac7434ea-13b7-4f67-8b01-0d21346f9477 | 7 | private static void processClasses(CompiledClass[] entries, int n)
throws Exception
{
Reflection implementor = new Reflection();
ClassPool pool = ClassPool.getDefault();
implementor.start(pool);
for (int i = 0; i < n; ++i) {
CtClass c = pool.get(entries[i].classn... |
235e8a47-16a6-4cd3-ba11-6c368c497107 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PhpposSuppliersEntity that = (PhpposSuppliersEntity) o;
if (personId != that.personId) return false;
if (accountNumber != null ? !accountNumber... |
257f5400-11cb-44d1-9354-c349b7b08d6f | 6 | public boolean syncOperation(List<String> state) {
System.out.println("[TEMP] Sync of " + this);
Operation old = getReferenceToOperation().getReferenceToOperation();
switch (old.operation) {
case 0:
return true;
case 1:
System.out.println("here");
System.out.println(startPosition + "" + old.sta... |
05c384e6-ac95-4963-9981-cbe6a2a24aec | 5 | public void lackOfFood(){
if(Variables.foodAmount <= 0){
if(Variables.deerPopulation >= 10){
Variables.deerPopulation = Variables.deerPopulation - 10;
Variables.foodAmount = Variables.foodAmount + 10;
}
if(Variables.deerPopulation < 10){
Variables.foodAmount = Variables.foodAmount + 10;
Varia... |
415dcb14-0bff-4206-b96b-e7569918dd90 | 6 | boolean isBlockDiag(int y, int x, int yp, int xp) {
int dy = yp-y;
int dx = xp-x;
if(Math.abs(dy)==1 && Math.abs(dx)==1)
{
if(this.isValidCord(y+dy, x) && this.isValidCord(y, x+dx))
{
if(this.isBlocked(y+dy, x) && this.isBlocked(y, x+dx))
... |
fd230b12-f588-4133-b11c-8291340a9b73 | 3 | public double[] readData(){
if( this.cur < 8)
{
return null;
}
double [] ddata = new double[this.cur/8];
long l;
int index = 0;
for(int i = 0 ; i < ddata.length; i++)
{
l=data[index++];
l&=0xff;
l|=((long)data[index++]<<8);
l&=0xffff;
l|=((long)data[index++]<<16);
l&=0xffffff;
... |
5ec2d1ac-1be3-4e96-80e2-5d3a4c0783f7 | 3 | public boolean save() {
if (mDirty) {
try {
SafeFileUpdater trans = new SafeFileUpdater();
trans.begin();
try {
File file = trans.getTransactionFile(mFile);
try (OutputStream out = new FileOutputStream(file)) {
mPrefs.storeToXML(out, BundleInfo.getDefault().getName());
}
} cat... |
7a7f2983-004e-499d-a1a3-b221d5a9d37b | 8 | public List<Integer> lexicalOrder(int n) {
LinkedList<Integer> list = new LinkedList<Integer>();
LinkedList<String> string = new LinkedList<>();
for (int i = 1; i <= n; i++) {
string.add(String.valueOf(n));
}
string.sort(new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
... |
452bdead-3582-4ce6-bd77-81d249052328 | 7 | @Override
public void rightMultiply(IMatrix other) {
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
copy[i][j]=0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
for (int k = 0; k < 4; k++) {
copy[i][j]=copy[i][j] + this.get(k, i) * other.get(j, k);
}
}
}
for (int i = 0; i < 4;... |
69714cb9-2302-4bfe-b32b-86acd4072e84 | 5 | public AirNowDataPoint[][] getDataPoints(){
ArrayList<ArrayList<AirNowDataPoint>> temp = new ArrayList<ArrayList<AirNowDataPoint>>();
for (AirNowDataPoint dataPoint : dataPoints){
String variableType = dataPoint.getParameterCd();
boolean added = false;
for (ArrayList<AirNowDataPoint> a : temp){
if (a.g... |
ff318a21-049d-4e2a-9743-a76c5365f5b0 | 8 | public void setData(FeatureCollection fc, String[] data_headers, String[][] data) {
this.fc = fc;
this.data_headers = data_headers;
this.data = data;
map_headers = fc.getHeaders();
map_data = fc.getData(map_headers);
int found = -1;
comboBoxMapLayer.removeAllItems();
for( int i = 0; i < map_headers.l... |
7afba7cf-9e56-4a68-9b51-9e9ab682ae7d | 2 | public void setPaddingWithZeroes(int length) {
if (length < 0) {
length = 0;
}
if (length > _DHCP_MAX_MTU) {
throw new IllegalArgumentException("length is > " + _DHCP_MAX_MTU);
}
this.setPadding(new byte[length]);
} |
a742862f-95ae-462d-90bc-b81ce53dafbd | 2 | public void updateRef(String key, U obj){
if(!this.bloom.isPresent(key)){
throw new IllegalArgumentException("key is not present");
}
synchronized(this.cache){
this.cache.put(key, new SoftReference<U>(obj));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream... |
d12100e9-b0d6-43ac-8810-9468c4a0591a | 8 | private StructuralToken getTokenFromOpenBracket() {
String c = getCharAtCurrentLineIndex();
if (c.equals("[")) {
linePtr++;
if (!lineHasNext()) { //Must be just a | barline
return new StructuralToken(StructType.BARLINE);
}
else {
... |
ebb3feaa-9a1b-4b67-8d2f-29231576a50a | 1 | public void visitEnd() {
text.add("}\n");
print(pw);
pw.flush();
if (cv != null) {
cv.visitEnd();
}
} |
39aca5ba-3b67-4376-b6ef-7b611cd79fc7 | 8 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
String line = "";
while ((line = in.readLine()) != null && line.length() != 0) {
int[] nb = readInts(line);
int n = nb[0], b = nb[1... |
61bb68d5-1479-44f6-b8cb-73e0e9203f80 | 8 | private void bookingTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bookingTableMouseClicked
if (bookingTable.getSelectedRow() > -1) {
int selectedRowIndex = bookingTable.getSelectedRow();
int bookingId = (Integer) bookingTableModel.getValueAt(selectedRowIndex, 0);
... |
049ae426-b111-46f5-8800-b6df6f5623c9 | 1 | public void windowClosing(WindowEvent e)
{
if(Main.gameRunning)
{
// DataIO.save(Main.currentGame, new File(Main.currentGame.aPath));
}
OptionsIO.save();
} |
7671115d-7046-4a3b-90e7-8127f05eae7b | 2 | private ArrayList<String> getTransitionsInputArray(String commaSeparatedInput) {
ArrayList<String> newArray = new ArrayList<String>(commaSeparatedInput.length());
for(int i=0; i<commaSeparatedInput.length(); i++) {
String c = commaSeparatedInput.substring(i, i+1);
if(c.equals(","... |
eee3038a-5d1e-4a0b-b6fa-c89c09fbc863 | 1 | private void finishMethod() {
if (currMethod!=null) { // finish the previous method
int codeEnd=tsize;
writeShort(0); // no exception table // TODO: add exceptions
writeShort(0); // no attributes
int currPos=tsize;
// Code attribute length
tsize=startCodeAttr+2;
... |
59c627c9-7074-46a3-aaf1-d80e9eeae8a9 | 1 | public void insertUser(UserData userData) throws SQLException {
if (conn != null) {
User user = new User(userData.id, userData.firstName, userData.lastName, userData.gender, userData.age);
user.insert(conn);
Availability availability = new Availability(userData.id, userData.email, userData.address);
a... |
4e1c51d0-be73-4f8e-86ce-e9c9c4d79569 | 4 | public static boolean isWorldScorePosted(int worldCreated) throws Exception {
File f = new File(CFG.DIR, "scores");
try {
if (!f.exists()) return false;
BufferedReader br = new BufferedReader(new FileReader(f));
String line = "";
while ((line = br.readLine()) != null) {
if (Integer.parseInt(line... |
dd86ea9f-e899-47f0-a58b-893158e7b205 | 0 | public void entering(final String name, final Object o, String ... args) {
info(StringUtils.shortName(o.getClass()) + "-" + o.hashCode() + " entering " + name + "(" + StringUtils.join(args, ", ") + ")");
} |
d152cf56-1239-4fbd-91fa-9476870d1f25 | 7 | public void setBorderType(String s) {
if (s == null)
throw new IllegalArgumentException("border cannot be null");
type = s;
if (s.equals(RAISED_BEVEL_BORDER)) {
border = BorderFactory.createRaisedBevelBorder();
}
else if (s.equals(LOWERED_BEVEL_BORDER)) {
border = BorderFactory.createLoweredBevelBord... |
371a3b41-14ed-46c1-9484-488b7702aec4 | 1 | public void testConstructor_ObjectStringEx3() throws Throwable {
try {
new TimeOfDay("1970-04-06T10:20:30.040");
fail();
} catch (IllegalArgumentException ex) {}
} |
76daacb0-f043-4493-a374-6e566eb93e73 | 2 | public void devientLeTairo(Set<Joueur> hjoueur){
int nbsceaux = 0;
for(Joueur j : hjoueur){
if(j.getTitre().getNbsceaux() > nbsceaux){
nbsceaux = j.getTitre().getNbsceaux();
this.tairo = j;
}
}
} |
cbebcfff-8255-49ea-9f6d-8a7c039fd586 | 6 | private void replaceText(Prize prize, XWPFDocument doc) {
for (XWPFParagraph p : doc.getParagraphs()) {
for (XWPFRun r : p.getRuns()) {
String text = r.getText(0);
if (text == null) {
continue;
}
if (text.indexOf("CLASSIFICATION") >= 0) {
String classification = String.format("%s %s", pri... |
833fda66-6059-4e7d-bde5-7e3a64474405 | 7 | public void letsBound(){
// first: weight the graph!
this.weightTheGraph();
// initialize the removed weight
this.weight_removed = 0.0;
// now, on the factor graph, compute the maximum spanning tree
// and save the list of edges to be removed
//... |
4937f22f-aff6-401d-b03c-2039da3566ca | 7 | public Sequence getReverseComplement(int start, int end) {
StringBuilder newStr = new StringBuilder();
for(int i=end-1; i>=start; i--) {
char compBase = '-';
char theBase = this.at(i);
switch(theBase) {
case 'A' : compBase = 'T'; break;
case 'G' : compBase = 'C'; break;
... |
5cb0212e-24f1-44ab-8047-6d236e02831b | 1 | public void updateProfile() {
tProfileSummary.setText(Manager.getInstance().getCurrentProfile().getProfileSummary());
DefaultListModel<String> dlm = new DefaultListModel<String>();
for (Disc disc : Manager.getInstance().getCurrentProfile().getDiscs().getDiscs()){
dlm.addElement(disc.getName());
... |
1ab81527-dc0a-402b-8a88-87386088097a | 1 | @Override
public boolean register(Game g, Rack r){
super.register(g, r);
rack_size = g.rack_size;
card_count = g.card_count;
//Setup reinforcement learning
if (use_reinforcement){
weights = new int[rack_size+1][card_count+1];
//reset stopping criteria
done_learning = false;
RI_stop.reset();
... |
e38da09a-74b5-4a4a-843f-9bf52b19808f | 7 | public static String[] resplitArgsWithQuotes(String[] args, int begin,
int end) {
ArrayList<String> ret = new ArrayList<String>(args.length);
StringBuilder line = new StringBuilder();
boolean inStr = false;
for (int i = begin; i < end; i++) {
String s = args[i];
if (inStr) {
boolean isEndStr = s.en... |
99ac8c3c-6668-4bf2-b9bb-384ed5439245 | 8 | private final boolean pushText(int delimiter) throws IOException {
boolean whitespace = true;
int next = mPeek0;
while (!mEOF && next != delimiter) { // covers EOF, '<', '"'
if (delimiter == ' ') {
if (next <= ' ' || next == '>') {
break;
}
}
if (next == '&') {
if (!pushEntity()) {
... |
79b4500e-a1f1-43c5-b4c4-ade449723cd4 | 7 | private boolean registered()
{
JLabel regNameLabel = new JLabel("Login name (4-10 chars):", JLabel.RIGHT);
JTextField regNameField = new JTextField(20);
JLabel regPasswordLabel = new JLabel("Password (2-10 chars):", JLabel.RIGHT);
JPasswordField regPasswordField = new JPasswordField(20);
... |
4ff44716-9425-42d6-9929-3d6a59d566e9 | 9 | public void loadFromSparseFile(String trainFile, String testFile, String quizFile, String featureFile, int featureCount)
{
System.out.print("Loading dataset... ");
this.featureCount = featureCount;
try
{
if(trainFile != null && trainFile.length() > 0);
loadDataFromSparseFile(trainFile, InstanceType.Tr... |
6c9eb865-3321-4a21-9fac-4a23f8f8ebdf | 8 | public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
String extension = Utils.getExtension(f);
if (extension != null) {
if (extension.equals(Utils.tiff) ||
extension.equals(Utils.tif) ||
extension.equals(Utils.gif)... |
5a53fce2-3d2a-4161-b5be-924bc7f6d775 | 2 | private void actionDisconnectFromAll() {
Component[] array = MainWindow.getInstance().getTabContainer().getComponents();
for (int i = 0; i < array.length; i++) {
Component component = array[i];
if (component instanceof ServerTab) {
ServerTab c = (ServerTab) compon... |
2979864e-e4b9-40c5-b59a-9e7e5e9c4a95 | 1 | public static String currentValues() {
String result = "";
Iterator it = inputTable.entrySet().iterator();
while(it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
result += pair.getKey() + "=" + pair.getValue() + "\n";
}
return result;
} |
df292d38-5f9a-4b69-ba93-c2f3de970553 | 6 | public BiCubicSplineShort(double[] x1, double[] x2, double[][] y){
this.nPoints=x1.length;
this.mPoints=x2.length;
this.csm = new CubicSplineShort(this.nPoints);
this.csn = CubicSplineShort.oneDarray(this.nPoints, this.mPoints);
this.x1 = new double[this.nPoints];
... |
af99d514-0575-4d2d-b9e0-ed00ba60399f | 1 | @Test
public void testAppendRow() throws Exception {
if(sampleDoc != null) {
String []strings = {"33445566","KK","Test City","1","1122334455"};
Row row = new Row(sampleDoc.getRecords().size() , strings );
sampleDoc.appendRow(row);
}
} |
abba2275-3105-4113-94f4-1620063b643f | 4 | public void playerLostAllLives(int id)
{
List<Controllable> players = entities.getList(Controllable.class);
for (Controllable plr : players)
{
if (plr.playerID() == id)
entities.removeEntity((Entity)plr);
}
if (menu != null && isGameOver())
... |
d79a117e-a7b2-4e2b-93f4-e8b262e338ed | 4 | private final String loadFile(final String filename) {
if (filename == null)
return null;
final File file = new File(filename);
final char[] data = new char[(int)file.length()];
try {
final FileReader reader = new FileReader(file);
if (reader.... |
ccc5186b-808f-4793-8024-1dbe2097d389 | 5 | public static void postToSubs(String str){
if(!userObj.getUser().contentEquals("GUEST")){
subFile = new File(userObj.getUser() + "Subs.UMW");
if(subFile.exists()){
try {
Scanner input = new Scanner(subFile);
while(input.hasNextLine()){
String tempFileName = input.nextLine();
postFile ... |
7574f528-ca68-4274-a45e-8608c92d80d8 | 3 | public static void encodeIntoImage(File containerImg, File outputFile, byte[] srcBytes, String key) {
try {
BufferedImage in = ImageIO.read(containerImg);
BufferedImage newImage = new BufferedImage(in.getWidth(), in.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g = ne... |
6c51b2e1-85a9-4cfe-aa98-88648bdb2f35 | 8 | @Override
protected void process(Map<String, Object> jsonrpc2Params) throws Exception {
//To change body of implemented methods use File | Settings | File Templates.
if(method.equals(Constants.Method.GET_THREAD_CONTENT)){
getThreadContent(jsonrpc2Params);
}
else if(metho... |
f8bc783d-61b4-4a19-bdff-faebaf6b6dd5 | 5 | public void mouseClicked(MouseEvent e) {
Point p = e.getPoint();
if (SwingUtilities.isRightMouseButton(e)) {
if (isInNavigationImage(p)) {
navZoomFactor = 1.0 - zoomIncrement;
zoomNavigationImage();
} else if (isInImage(p)) {
zoomFactor = 1.0 - zoomIncrement;
zoomImage();
}
} el... |
05896d92-1a76-49f9-bfc7-edd8b384b565 | 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... |
c756d3b3-c10b-417a-a251-db5c7be9564f | 5 | public Set<List<Integer>> computePartition(List<String> attributesByName){
Set<List<Integer>> partition = new HashSet<List<Integer>>();
//Make a new list of integers to store some hashed strings (could maybe use array instead)
List<Integer> hashedAttributes = new ArrayList<Integer>();
//Concat (string) values o... |
ef09da85-5a3c-47f5-af69-dc22df53d0da | 6 | private Move askPredatorForMove() {
// Get the All possible edges for the predator
final Set<Edge> allPossibleEdges = Ship.getAll(ship.getPredatorNode().getCoordinates(), ship, connectedShip);
// Get the adjacent edges for the predator
final Set<Edge> ad... |
a168abec-bbae-4e1e-8462-d19278f6a925 | 5 | @Override
public void setValueAt(Object value, int row, int col) {
User user = (User) globalData.get(row);
switch (col) {
case INDEX_ID:
// this can't be changed..
break;
case INDEX_FIRSTNAME:
try {
user.setFirstName((String) value);
} catch (InvalidFieldException e1) {
}
break;
case... |
63f97daa-3520-4171-8529-03ef17e3ed68 | 3 | public boolean isSubtree(TreeNode<Integer> root1, TreeNode<Integer> root2) {
if (root2 == null)
return false;
if (treeMatch(root1, root2))
return true;
return isSubtree(root1.left, root2) || isSubtree(root1.right, root2);
} |
1db3b571-8032-4879-bb1d-1f2ef900e56a | 6 | public static ArrayList <RobotData> loadData() {
File load = new File("resources/files/RobotData/");
Gson loader = new Gson();
ArrayList <RobotData> res = new ArrayList <RobotData>();
for (File f : load.listFiles()) {
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(f));
} cat... |
27ee3b23-7268-45f4-9888-29bcdeddaf9d | 1 | public String toString() {
return this.mode == 'd' ? this.writer.toString() : null;
} |
a2cd7d20-bb20-4065-8b41-d3615feaac2f | 0 | public void setKeyProfileId(String value) {
this.keyProfileId = value;
} |
22ea54ca-6f7b-4495-bda3-ef02807f83e7 | 9 | public void genC(PW pw) {
if (aug == Symbol.DIVASSIGN) {
pw.print("/=");
}
if (aug == Symbol.MODASSIGN) {
pw.print("%=");
}
if (aug == Symbol.MINUSASSIGN) {
pw.print("-=");
}
if (aug == Symbol.ASSIGN) {
pw.print("=")... |
a1cdd521-2b48-4477-b926-335c5a29c5b5 | 2 | @Override
public void updateIngredient(Ingredient c) throws IngredientRepositoryException {
validate(c);
try(Connection connection = DriverManager.getConnection(connectionString)){
PreparedStatement statement = connection.prepareStatement("update ingredient set name = ? where id = ? ");
statement.setString(1... |
05ff8f39-7346-4241-b309-3a50e644ec4d | 9 | void getFirstMove() {
int x = 1;
int y = 1;
int[] humanLoc = lastSpaceMoved.pos;
// If center --> random corner
if (humanLoc[0] == 1 && humanLoc[1] == 1) {
if (Math.random() < .5)
x = 0;
else
x = 2;
if (Math.random() < .5)
y = 0;
else
y = 2;
}
// If corners --> random adjacent ... |
ced2684f-12a9-4de5-a1b3-10dd7758921a | 9 | public String validarDatosAltaUsuario(String nombre, String apPaterno, String apMaterno, String usuario, String password,String permisos)
{
String errorLog ="";
Usuario resultadoBusqueda = new Usuario(true);
Object[] resultado = null;
Object[][] o... |
634fb71d-e4fe-47f5-8f0a-177d02447e1c | 3 | @Override
public void deleteResult(String key, String text) {
if(results.get(key) != null){
for(int i = 0; i < results.get(key).size(); i++){
if(results.get(key).get(i).getSolution().contains(text)){
results.get(key).remove(i);
}
}
}
} |
d2815b8f-a32f-400e-8cb7-d444bb992e6d | 1 | @Override
public void dragExit(DropTargetEvent dte) {
if (mDragDockable != null) {
clearDragState();
}
} |
9ef689cf-e437-42d6-9274-9ba4170788d7 | 6 | public void testConstructor_int_int_int() throws Throwable {
LocalTime test = new LocalTime(10, 20, 30);
assertEquals(ISO_UTC, test.getChronology());
assertEquals(10, test.getHourOfDay());
assertEquals(20, test.getMinuteOfHour());
assertEquals(30, test.getSecondOfMinute());
... |
be5982eb-bd80-4e4a-a703-b7727c7b3f30 | 5 | @Override
public Program generateOffspring(Program firstParent, Program secondParent) throws InvalidProgramException {
if (!(firstParent instanceof ProgramImpl) || !(secondParent instanceof ProgramImpl)) {
throw new InvalidProgramException();
}
ProgramImpl offspring = ((ProgramImpl) firstParent).clone();
Pr... |
fa16827c-82f0-4391-a347-69fbecac6675 | 3 | public void destroyCritter(Critter item){
synchronized(lock_critter){
ListIterator<Critter> iter = play_pen.listIterator();
Critter kill = null;
while(iter.hasNext()){
Critter temp = iter.next();
if(temp.equals(item)){
kill = item;
break;
}
}
if(kill != null){
play_pen.remove(... |
c7a2b70b-d69e-4601-a627-2e135bf1a299 | 1 | public static String[][] getUsernames() {
List<User> list = DataProvider.getUsers();
String[][] usernames = new String[list.size()][4];
Iterator<User> it = list.iterator();
for (int x = 0; it.hasNext(); x++) {
User user = it.next();
usernames[x][0] = String.valueOf(user.getId());
usernames[x][1] = user... |
843bee2a-cd23-4997-bf97-66005e4799d2 | 2 | public int getInt(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).intValue()
: Integer.parseInt((String) object);
} catch (Exception e) {
throw new JSONException("JSONArray[" ... |
e08f3a64-990b-4dc3-bdae-41ed568a0614 | 3 | public void autoPromoterCheck(Player player) {
String curRank = perms().getPrimaryGroup(player);
if ( config.promoterWatchingRank(curRank) )
if ( getASPlayer(player.getName()).total.getActivity() > config.promoterPoints(curRank) )
if ( perms().playerAddGroup(player, config.promoterRankTo(curRank)) )
in... |
7433c351-7096-412e-9377-1688eae6dfc5 | 9 | void popDuskObject(DuskObject objIn)
{
synchronized(objEntities)
{
if (objIn.intLocX < 0 || objIn.intLocY < 0 || objIn.intLocX >= MapColumns || objIn.intLocY >= MapRows)
{
return;
}
if (objEntities[objIn.intLocX][objIn.intLocY] == null)
{
return;
}else
{
if (objEntities[objIn.intLo... |
3c086bef-19d5-4769-9ce2-c9e98f10890b | 9 | public static boolean parsebool(String s, boolean def) {
if (s == null)
return (def);
else if (s.equalsIgnoreCase("1") || s.equalsIgnoreCase("on")
|| s.equalsIgnoreCase("true") || s.equalsIgnoreCase("yes"))
return (true);
else if (s.equalsIgnoreCase("0") |... |
1e0adf74-9aef-421a-98ec-4bb70eeb935d | 0 | @Test(dataProvider = "addressBookDataProviderAsIterator")
public void addressBookDataNotEmpty(String first, String second, String third) {
Assert.assertFalse(first.isEmpty());
Assert.assertFalse(second.isEmpty());
Assert.assertFalse(third.isEmpty());
} |
f2f6d0ad-db44-4099-a692-955a5217bff4 | 5 | @Override
public void execute() {
if(Global.useRejuvenate && ActionBar.getAdrenaline() == 1000 && ActionBar.getNode(0).canUse()){
ActionBar.getNode(0).use();
Task.sleep(1000);
}else if(Global.eatFood && Methods.getHpPercent() <= HEAL_PERCENT - 10){
Inventory.getI... |
92bfb6b4-34a5-458c-ad64-b499665b32d3 | 1 | private void renderItemChose() {
if (validChosenItemIndex())
label.setText("Choosen index is: " + getChosenItemIndex());
} |
437ff162-da4e-404d-bf2f-1a8e0d1cdeda | 2 | public Expression simplify() {
for (int i = 0; i < subExpressions.length; i++) {
if (subExpressions[i] != null)
subExpressions[i] = subExpressions[i].simplify();
}
return this;
} |
cde90d6b-a233-47fd-8c11-062c3f4e0395 | 8 | private synchronized void calculateNextMonth() {
int initialSize = this.schedule.size();
// If the schedule has already been generated
if (this.schedule.size() > 0) {
scheduleUpdate();
}
// Used to see if month changes
int currentMonth... |
9c7a507c-f63c-4130-9968-7dc0bc8da5c2 | 2 | static long shift(int cnt){
if(cnt<32)
return cnt>1?(1<<(cnt-1)):1;
else
return (long) Math.pow(2, cnt-1);
} |
81b35297-bc55-45a7-923f-687e3aae9142 | 1 | public static void log(String message)
{
String lines[] = message.split("\n");
for (String l : lines)
{
String temp = "";
String date = new SimpleDateFormat("MM/dd/yyyy hh:mm:ssa").format(Calendar.getInstance().getTime());
temp = date + ": " + l;
System.out.println(temp);
}
} |
88db459e-d42d-4e3d-bd3d-ef9540aac6f6 | 3 | public ControleurListe(Liste liste, VueListe vueListe) {
Liste_ = liste;
vueListe_ = vueListe;
// vueListe.getTableListe().getModel().addTableModelListener(this);
vueListe.getTableListe().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent mE) {
if (mE.getClickCount() =... |
f7051124-b547-41d3-8e0b-3ff19e032861 | 7 | public boolean importData(TransferSupport supp)
{
/* do not continue if the drop is not of a supported flavor */
System.out.println("FileTransferHandler::importData()\n type:: "+ supp.getDataFlavors()[0]);
if (!canImport(supp))
{
System.out.println("Drop type ::" + supp.getDataF... |
5f4551e8-04e7-4def-9652-854970ae9544 | 8 | public void faireAction(Tamagoshi monTama) {
Scanner entree = new Scanner(System.in);
System.out.println("\n\n\n\n\n");
System.out.println("1-Manger 2-Boire 3-Se laver 4-Se faire beau 5-Dormir 6-Aller aux toilettes 7-Retour");
//Entre le choix
int choix=0;
try {
... |
9b657fb8-0ef7-4dde-ab33-8dc16b69ac01 | 8 | protected void countIfNecessary(Item I)
{
if(CMLib.flags().isInTheGame(I,false))
{
int max=CMath.s_int(text());
List<Item> myInstances=null;
synchronized(instances)
{
if(!instances.containsKey(I.Name()))
{
myInstances=new Vector<Item>();
instances.put(I.Name(),myInstances);
myIns... |
b7aae1ce-91c3-4967-9f10-9fcc6593d0b8 | 8 | @Override
protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
Taikhoandangnhap account = (Taikhoandangnhap) request.getSession()
.getAttribute("user");
Soyeulylich soyeulylich = account.getSoyeulylich();
(ne... |
17e1b822-7d0d-4db5-873f-dfcaefd8ad7f | 9 | @SuppressWarnings("unchecked")
public void initialize(String pathToYml) throws IOException {
YamlReader reader = new YamlReader(new FileReader(pathToYml));
Map<String, Object> input = (Map<String, Object>) reader.read();
this.blastDbSettings = (Map<String, Map<String, String>>) input
.get(BLAST_DBS_KEY);
s... |
3895e2a5-3327-4e0c-b9e9-ff22226a07ae | 3 | public static Position bestAproxPositionOf(List<Position> pos, Position refPosition, double APROX)
throws NoPositionAvailableException
{
Position best = null;
double normBest = APROX+8;
for(int i = 0; i < pos.size(); i++)
{
double tempNorm = new Vector(refPosition, pos.get(i)).norm();
if(tempNorm < n... |
8d8b10a2-57d8-4209-ae75-71545f28c8d5 | 1 | public MiniXMLState getChild(int state, int token) {
Integer oToken = new Integer(token);
if (!children.containsKey(oToken)) {
MiniXMLState child = new MiniXMLState(state, token, this);
children.put(oToken, child);
}
return (MiniXMLState) children.get(oToken);
} |
6168c8df-7a5c-423b-90f6-f3cbc3de6bfe | 6 | private void treeRefresh(File[] masterFiles) {
TreeItem[] items = tree.getItems();
int masterIndex = 0;
int itemIndex = 0;
for (int i = 0; i < items.length; ++i) {
final TreeItem item = items[i];
final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
if ((itemFile == null) || (masterIndex == mas... |
7bff67ab-adc3-4c14-a222-c3558b467736 | 0 | public void removeChatGuiListener(ChatGuiListener listener) {
chatGuiListener.remove(listener);
} |
d261f22f-a861-42e0-8f4c-d078b72cd103 | 0 | public static void main(String[] args)
{
System.out.println("Hello");
IntNode head = new IntNode(111, null);
IntNode node = new IntNode(555, head);
IntNode node2 = new IntNode(777,node);
System.out.println("good morning");
System.out.println(head.toString());
System.out.println("node");
System.out.... |
9e1b8589-eaf8-4c00-a654-ce001738fc97 | 4 | @RequestMapping(value = "/{worldId}/{mapId}/{eventId}")
@ResponseBody
public List<Event> getEventByWorldAndMapAndEvent(@PathVariable int worldId, @PathVariable int mapId, @PathVariable String eventId) {
List<Event> result = new ArrayList<Event>();
List<Event> events = data.getEvents();
for(Event event : events)... |
ce1ed288-bcb5-4da2-b68f-e643fccc5550 | 6 | private Point getFirstWithOtherType(int sX, int sY, int dX, int dY, int type) {
int cX = sX + dX;
int cY = sY + dY;
while (cX >= 0 && cX < _nX && cY >= 0 && cY < _nY && _state[cY][cX] != null && _state[cY][cX].getType() == type) {
cX += dX;
cY += dY;
}
return new Point(cX, cY);
} |
9463e411-8f5a-49c4-bc41-d56e38c78e26 | 2 | void enableForGroovy() {
saveButton.setEnabled(true);
runButton.setEnabled(false);
clearButton.setEnabled(false);
editButton.setEnabled(false);
graphButton.setEnabled(false);
docButton.setEnabled(false);
syslogCombo.setEnabled(false);
logLabel.setEnabled(... |
6462b43c-b87b-47d3-a814-0c48ba0e0a6b | 1 | private void onUnpause() {
if (!downloadsTable.getSelectionModel().isSelectionEmpty()) {
int id = downloadsTable.convertRowIndexToModel(downloadsTable.getSelectedRow());
Integer gid = (Integer) downloadsTable.getModel().getValueAt(id, 0);
downloadManager.unpauseDownload(gid);... |
9aa46f47-0146-4a14-8129-cdfa686e5f6c | 9 | private static IFuzzyCommand parseOperator(String[] tokens) throws FuzzyParserException {
if(!tokens[0].equals("set") || !tokens[3].equals("to")) {
throw new FuzzyParserException("Illegal command format!");
}
String sign = tokens[2];
String opID = tokens[4];
IOperator operator;
switch(opID) {
cas... |
0ca1fca9-2fcf-46fa-9e15-eb601e065608 | 6 | @Override
public void run(){
System.setProperty("http.proxyHost", addr);
System.setProperty("http.proxyPort", port);
URL url;
InputStream in;
try {
url = new URL("http://www.xiami.com");
in = url.openStream();
if(in!=null){
byt... |
fd089fd9-7421-44a5-8ad2-ec0479c2e3d4 | 7 | private static int session() {
int resul[] = new int[CAN.length]; // tableau contenant les résultats de chaque personne
double pourc[] = new double[CAN.length]; // tableau contenant les résultats sous un pourcentage
int somme; // contient le nombre total de vote
int vote; ... |
530664b7-0354-4021-aa1b-acd7fa74695a | 4 | @Override
public void paint(Graphics g) {
super.paint(g);
Iterator<Pfad> pfadIterator = laenderGraph.getPathIterator();
g.drawImage(bild, 0, 0, null);
while (pfadIterator.hasNext()) {
Pfad tmpPathRef = pfadIterator.next();
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(new Bas... |
27376cc4-ce9f-4bb4-b192-aeb481e13e0e | 2 | public static int search_var_by_name(Variable_table variable_table, String name) {
int num = variable_table.variable_name.size();
for (int i = 0; i < num; i++) {
if (variable_table.variable_name.get(i).toString().equals(name)) {
return i;
}
}
retur... |
3bb52d54-6dd8-43eb-9cc7-596e86cda8b9 | 7 | public void generateMoves(Piece[][] squares, ArrayList<Move> validMoves, ArrayList<Move> validCaptures) {
// for each possible direction (NE, SE, SW, NW)
int xPos;
int yPos;
for (int direction = 0; direction < xMoves.length; direction++) {
xPos = xPosition + xMoves[direction];
yPos = yPosition + yMoves[d... |
9c1e9757-400e-418e-a36d-458f9feab16d | 2 | private void acao165(Token token) throws SemanticError {
if (tipoFator != Tipo.BOOLEANO) {
throw new SemanticError("Operador 'não' exige operando BOOLEANO",
token.getPosition());
}
if(!indexandoVetorParametro)
parametroAtualPodeSerReferencia = false;
} |
9fe14f28-da20-48dc-bf84-2e0eaf98ee92 | 6 | public int maxProfitRange(int startIndex, int endIndex, int[] prices) {
int maxProfit = 0;
if (endIndex == startIndex) {
return maxProfit;
}
// only two numbers in range
if (endIndex - startIndex == 1) {
int curProfit = prices[endIndex] - prices[startIndex];
if (curProfit > maxProfit)
maxProfit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.