method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
aec19a37-6562-43fa-b712-41d2e8dab165 | 7 | private void checkBottom(TetrominoMoveSelector moves, Tetromino tetromino, int x, int y) {
if(y + tetromino.getHeight() >= height){
moves.removeTranslateBottom();
}else{
loop :
{
for (int i = 0; i < tetromino.getHeight() && y + i < height; i++) {
... |
65d92ac4-86e6-4ce7-886f-78faa65ce162 | 3 | public static void validateCountry(Country country) throws TechnicalException {
if (country == null) {
throw new TechnicalException(MSG_ERR_NULL_ENTITY);
}
if ( ! isStringValid(country.getName(), NAME_SIZE)) {
throw new TechnicalException(NAME_ERROR_MSG);
}
... |
b31e504d-9b39-4fe8-80fe-5d8369465967 | 5 | public boolean possede(Groupe g){
boolean possession = true;
boolean proprieteposseder = false;
for(ProprieteAConstruire pg : g.getProprietes()){
proprieteposseder = false;
for(ProprieteAConstruire pj : this.proprietesAConstruire){
if(pg.equals(pj)){ propr... |
1e8f28b7-e578-42a4-b8a9-9cb7a84fc0dc | 7 | private void readExecuteCommand() {
String[] cmnd = _inp.nextLine().trim().split("\\s+");
try {
if (isInteger(cmnd[0])) {
if (!_playing) {
throw error("no game in progress.");
}
if (cmnd.length >= 2) {
in... |
adfc1221-cbb5-4bc7-bfde-ec46aff5c9da | 9 | @EventHandler(priority = EventPriority.HIGHEST)
public void blockBreak(BlockBreakEvent event) {
//System.out.println("block break event");
if (!this.p.getOn().get(event.getPlayer().getWorld())){
return;
}
if (event.getBlock().getType() == Material.IRON_DOOR_BLOCK && event.getBlock().getRelative(0, -1, 0).ge... |
4b2987d6-e271-469c-bb38-37e8dbd7377d | 1 | public void StopCallTime()
{
if(callTimeTask!=null) callTimeTask.cancel();
callTimer.purge();
} |
f3bc9c78-852e-4f2f-8653-8ce5f6f093e9 | 7 | private Conclusion extractConclusion(String endElement) throws ParserException, XMLStreamException {
ConclusionType conclusionType = null;
Literal literal = null;
for (int i = 0; i < reader.getAttributeCount(); i++) {
String attributeName = reader.getAttributeLocalName(i);
String attributeValue = reader.get... |
e3027872-83cf-430f-b5c4-b0de1b2c45fa | 5 | protected void processDoubleClick(MouseEvent e) {
if (MODE_EXPAND_DOUBLE_CLICK == expand_mode) {
textArea.node.getTree().setSelectedNodesParent(textArea.node.getParent());
textArea.node.getTree().addNodeToSelection(textArea.node);
if (textArea.node.isExpanded()) {
if (e.isShiftDown()) {
textArea... |
704ad0ac-9832-4fea-a1b1-e1b56695ac30 | 9 | @Override
public boolean save(User user) {
boolean isNewUser = true;
long lastUserId = 0;
List<User> users = new ArrayList<User>();
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
for (String s = reader.readLine(); s != nul... |
52483c0e-ffca-47aa-a0e9-52b44b5e9004 | 2 | public void undo(Board board) {
//Searches desired column from top to bottom
int h = Util.firstEmptyPosition(board, this.getCol());
if (h != board.getHeight()) {
if (h < Util.ERRORTHRESHOLD) {
h = Board.MINHEIGHT - 1;
}
board.setPosition(this.getCol(), h+1, Counter.EMPTY);
}
else {
System... |
ae4dd956-c6fc-4a44-b38b-acc37fd07df2 | 6 | protected void consolidate(ArrayList<Space> queue, ArrayList<Space> addingLocations) {
for (Space i : addingLocations) {
Space test = null;
boolean addI = true;
for (int j = 0; j < queue.size(); j++) {
test = queue.get(j);
if (test.loc.getRow()... |
22b206ff-8506-4425-863d-e24ae95d21d2 | 0 | public double getAttackScore(){
return attackScore * (this.attackSpeed/100);
} |
2e8a5881-2704-4e53-89e8-4e4c10f53002 | 8 | public static void main(String[] args) throws Exception {
String inputfile = "";
String testfile = "";
if(args.length != 2) {
System.out.println("Error in the arguments");
}
else {
inputfile = args[0];
testfile = args[1];
}
DecisionTree testDt = new DecisionTree();
int testDtStatus = testDt.... |
e49fbfd8-98cc-460c-94d4-f07ddfd38e4a | 3 | public void actionPerformed(ActionEvent paramActionEvent)
{
if (paramActionEvent.getActionCommand().compareTo("bay") == 0)
{
setState(0);
return;
}
if (paramActionEvent.getActionCommand().compareTo("view") == 0)
{
setState(1);
return;
}
if (paramActionEvent.getA... |
a19629cd-bf75-4fb5-a2d3-2ab4cf4c41c9 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof OptionalArray)) {
return false;
}
OptionalArray<?> other = (OptionalArray<?>) obj;
return Objects.equals(value, other.value);
} |
d0ff4d58-fe7d-4287-8ff5-4f2d68aae93a | 8 | public static void main(String[] args)
{
try
{
if(args != null)
{
if(args.length > 0)
serverPort = Integer.parseInt(args[0]);
else
{
serverPort = 35565;
}
i... |
e6f4c1a8-0b2b-4042-be3d-62c726e41d95 | 7 | public void tick() {
if (retardation > 0) {
int r = retardation;
while (r-- > 0) Thread.currentThread().checkAccess();
}
current++;
long time = System.currentTimeMillis();
if (time / 1000 > timestamp / 1000) {
System.out.println((current / 1000D) + " MHz @ " + retardation);
}
if (time > timesta... |
e1c7bdde-c14a-4a2d-ad07-12231795cac3 | 0 | protected final void setFinger(String finger) {
_finger = finger;
} |
93c29b35-e62a-4f93-ad84-a4a87e706b6b | 6 | public static String
encode(
final byte[] bytes )
{
int i =0, index = 0, digit = 0;
int currByte, nextByte;
StringBuffer base32 = new StringBuffer((bytes.length+7)*8/5);
while(i < bytes.length)
{
currByte = (bytes[i]>=0) ? bytes[i] : (bytes[i]+256); // unsign
... |
b2847aa1-8e96-42f4-a271-b63f890b6113 | 4 | public void setNumber(int number) {
final String numericString = String.valueOf(number);
final int length = numericString.length();
fill(1, 1, width - 2, height - 2, new ScreenCharacter(' '));
if (number != 0) {
if (length > width - 2) {
//TODO fix issues with centering text
final int lines = (int... |
e9f93652-6227-4a9a-9a23-da1865877920 | 4 | public Point getKnobContainingPoint(Point pt) {
if (firstCorner.contains(pt)) {
// index[0] = 0;
return new Point(((Rectangle) shape).x + ((Rectangle) shape).width, ((Rectangle) shape).y + ((Rectangle) shape).height);
} else if (secondCorner.contains(pt)) {
// index... |
b2f9b893-15be-4025-8c1c-cc38f99156cc | 6 | public String execute(SaveNoteObject saveNoteObject) throws SQLException{
String answer = "";
boolean author = false;
resultSet = queryBuilder.selectFrom("Events").where("eventName", "=", saveNoteObject.getEventName()).ExecuteQuery();
if(resultSet.next()){
String calendarID = resultSet.getString("calendari... |
51d65d10-338e-4f80-8481-f5ba8a450015 | 7 | @Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
if(sprung && (affected instanceof MOB))
{
if((!disabled)&&((tickDown>2)&&(tickDown<13)))
{
if((((MOB)affected).charStats().getBreathables().length>0)
&&(Arrays.binary... |
81fce86f-76ab-49ff-9e09-1188e2a21052 | 0 | public TBItemFetcher(RequestWrapper requestWrapper) {
super(requestWrapper);
} |
e4e636fd-09f4-4dcd-81c9-98e1c4d12b01 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((myHost!=null)
&&(myHost instanceof MOB)
&&(msg.amISource((MOB)myHost)))
{
if((msg.targetMinor()==CMMsg.TYP_LEAVE)
||(msg.sourceMinor()==CMMsg.TYP_ADVANCE)
||(msg.sourceMinor()==CMMsg.TYP_RECALL)
||(msg.sourceM... |
680a7be0-0ced-4d20-b334-5a43f8c0bccc | 6 | protected boolean validArgs(CommandSender sender, String maincmd, String[] args)
{
String[] messages = null;
if (args.length - 1 < minArgs || args.length - 1 > maxArgs)
{
messages = new String[2];
messages[0] = ChatColor.RED + "Too " + (args.length - 1 < minArgs ? "few" : "many") + " arguments." + ChatCol... |
c7a1bfa1-cba2-411a-a280-d03c7e03ba7f | 2 | public static int[] stringToInts(String string) {
int[] a = new int[string.length()];
int found = 0;
for (int i=0; i<string.length(); i++) {
if (Character.isDigit(string.charAt(i))) {
a[found] = Integer.parseInt(string.substring(i, i+1));
found++;
}
}
int[] result = new int[found];
System.arra... |
82f1e363-2dd7-415c-a126-594433f9bb70 | 1 | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
java.security.cert.X509Certificate[] chain = null;
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
KeyStore tks = KeyStore.getInstance("JKS");
tks.load(this.getClas... |
cc780d65-df2c-49d8-a0d2-b39903038e4b | 1 | private int GetDigit(int number, int pos)
{
int i;
for (i = 0; i < pos; i++) number /= 10;
return number % 10;
} |
453fe201-b2bc-471f-8d2e-e77c5f88355b | 3 | public void reload() {
try {
config.load(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidConfigurationException e) {
e.printStackTrace();
}
} |
3c38bb03-8dcd-4540-b58c-6dd69978d1fd | 6 | public synchronized void startMusicPlayerWithUrl(String url, String name) {
//get the selected Stream
Stream stream = new Stream(name,0);
stream.address = url;
//Test if a relay stream is running and connect to them
//else will connect to stream address directly
if(stream.getStatus() && stream.connectT... |
504345a5-2331-4171-9a84-2043fa60a782 | 5 | static String getChildInfo(String id)throws SQLException {
StringBuilder sb = new StringBuilder();
try (PreparedStatement ps = conn.prepareStatement("select MZ, RELATIVE_ from PEAK where ID=? order by MZ")) {
ps.setString(1, id );
ResultSet rs = ps.executeQuery();
while (rs.next()) {
... |
8814551a-65b2-45d6-a4d5-86a6f702f8f9 | 7 | @Override
public int takeStep()
{
fillVariables();
if (myRobotAPI.blocked() && !secondGoalkeeper) {
this.goToGloDestination(this.gloMyPosition, this.gloOurFirstGoalPost, 0);
if (this.nearGloPosition(this.gloMyPosition, this.gloOurFirstGoalPost, 0)) {
myRobotAPI.setSpeed(0);
... |
0d863274-53e1-4f75-ae89-92b9a1a3b98b | 3 | @Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != IdMapEntry.class) {
return false;
}
IdMapEntry i2 = (IdMapEntry)obj;
return id == i2.id && name.equals(i2.name);
} |
f1b854d6-3852-4cee-bf17-349df30e3489 | 4 | public Iterable<MyEdge> calculatePath(int from, int to) {
car = CreateGUI.returnInstance().getRb_car().isSelected();
fastestRoute = CreateGUI.returnInstance().getRb_fast().isSelected();
avoidHighways = CreateGUI.returnInstance().getAvoidHighways().isSelected();
avoidFerries = CreateGUI.returnInstance().getAvoid... |
72bfab02-6a82-4794-beb0-8c054233232f | 2 | @Override
public void reactPressed(MouseEvent event) {
if (isPressed) {
isPressed = false;
releaseImage();
StateMachine.setMuteAPressed(false);
} else {
if (mt.isPressed())
mt.reactPressed(null);
isPressed = true;
... |
cc092607-cb8b-4cd8-815d-6e252f73e199 | 2 | private static Object[] asArray(final List l) {
Object[] objs = new Object[l.size()];
for (int i = 0; i < objs.length; ++i) {
Object o = l.get(i);
if (o instanceof LabelNode) {
o = ((LabelNode) o).getLabel();
}
objs[i] = o;
}
... |
a414e740-37d9-4d3c-8cf7-df4c74d2dfc8 | 2 | public boolean removeReply(User user, Message message){
if(user.hasPermission(Permissions.DELETE_MESSAGE) || message.isWriter(user)){
replies.remove(message);
save();
return true;
}
return false;
} |
d8b97f56-4da8-4d63-98e8-18880e9ca578 | 5 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null || !Room.CheckRights(Main.Data, true) || Room.Event == null)
{
return;
}
Room.Event.Category = Main.Deco... |
db590dbd-7e01-4579-aef6-f9aaec504c06 | 2 | static Set<String> methodSet(Class<?> type) {
Set<String> result = new TreeSet<String>();
for (Method m : type.getMethods())
result.add(m.getName());
return result;
} |
1808524a-babf-4acc-b8fd-e42e99b04739 | 0 | @Test()
public void getOldestPerson() throws ParseException {
Assert.assertEquals(addressBook.getOldestPerson(), "Wes Jackson");
} |
6a9c52d9-9ede-4e4f-9efc-e5db77530d7f | 2 | private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
if (cmbBuscaFuncionario.getSelectedItem().equals("Selecione")) {
JOptionPane.showMessageDialog(null, "Erro selecione o departamento",
"Departamento", JOptionPane.ERRO... |
3da43ba2-ba01-4413-a122-184a80e23e55 | 6 | public T delete(int index) {
if (index < 0 || index >= this.size) throw new IndexOutOfBoundsException();
// handle a single element linked list
if (this.size == 1) {
MyNode nodeToDelete = this.head;
this.head = null;
this.tail = null;
this.size--;
return nodeToDelete.data;
}
// hand... |
df29138d-8ad8-4820-b62e-2cb75afd360f | 5 | static Object[][] abs(Object[][] z) {
Object[][] ret = new Object[z.length][];
for (int i = 0; i < z.length; i++) {
ret[i] = new Object[z[i].length];
for (int j = 0; j < z[i].length; j++) {
Object a = z[i][j];
if (a == null)... |
33a7cb2f-b467-4994-8c29-9b686ae3ffa0 | 0 | public synchronized void removeListener(DecadeListener l) {
listeners.remove(l);
} |
80cb1981-ab0b-4412-ba7b-900eb4c0e205 | 4 | public BellmanFordSP(EdgeWeightedDigraph G, int s)
{
vertex = new Vertex[G.V()];
queue = new LinkedList<Vertex>();
subProblemSize = 0;
for (int i = 0; i < G.V(); i++)
vertex[i] = new Vertex(i, Double.POSITIVE_INFINITY);
vertex[s].distTo = 0.0;
queue.addFirst(vertex[s]);
vertex[s].onQ = true;
subPr... |
9b3aa709-457b-4319-ac67-bad525ce4782 | 1 | public Stats clone() {
HashMapStats myClone = new HashMapStats();
for (Stat stat : stats.values()) {
myClone.put(new Stat(stat.getType(), stat.getValue()));
}
return myClone;
} |
bbb6155a-0b00-4a57-9299-af5949fe402a | 9 | private void addNewCounterEvidence() {
String titleValue = titleNAJtxt.getText()
, descriptionValue = descriptionNAJtxa.getText()
, parentClaimTitle = null;
Object parentClaimO = listOfClaimsNAJcbx.getSelectedItem();
Claim parentClaim = null;
if (parentClaimO != null) {
parentClaimTitle = parentClaim... |
16944c20-07e6-4266-9034-bf1dbe590b7d | 2 | public void error(String message, String sourceName, int line, String lineSource, int lineOffset) {
if (line < 0) {
System.err.println("[ERROR] HtmlCompressor: \"" + message + "\" during JavaScript compression");
} else {
System.err.println("[ERROR] HtmlCompressor: \"" + message + "\" at line [" + line + ... |
044a4246-d6c0-4616-a3a8-ea2729a793c6 | 8 | static float lpc_from_data(float[] data, float[] lpc,int n,int m){
float[] aut=new float[m+1];
float error;
int i,j;
// autocorrelation, p+1 lag coefficients
j=m+1;
while(j--!=0){
float d=0;
for(i=j;i<n;i++)d+=data[i]*data[i-j];
aut[j]=d;
}
// Generate lpc coeffici... |
917853e9-f559-41fa-b635-a81eaf69b596 | 1 | private final Object[] addHeader (Object[] payload) {
String nonce = generateNonce();
Object[] message = new Object[4 + payload.length];
message[0] = VERSION;
message[1] = gameid;
message[2] = SHA1(apiKey + nonce);
message[3] = nonce;
for (int i = 0; i < payload.length; i++) message[i + 4] = payload[i]... |
61572223-f3ce-4467-96e9-1e2684aa2519 | 8 | private void checkWetState() { //controls effects from water immersion
if (isCurrentlyWet())
{
wetTimer = wetTimer + 1;
if (wetTimer > WETLIMIT[ageState.ordinal()])
{
wetCount = wetCount + 1;
wetTimer = 0;
}
if (wetCount == 0)
{
soaked = false;
melting = false;
dis... |
317e9625-26a0-4a9c-9c6f-fecd291db45c | 6 | public void updateSprites() {
// loop through sprites
for (int i = 0; i < sprites.size(); i++) {
// load the sprite
PlayerSprite s = sprites.get(i);
Level l = levels.get(0);
if (!l.isLapRace()) {
s.setScore(s.getHealth());
}
else {
getRacePositions();
... |
4da8126d-12c3-46eb-872f-187d7167eff5 | 9 | public Expression simplify() {
if (subExpressions[0] instanceof CompareToIntOperator) {
CompareToIntOperator cmpOp = (CompareToIntOperator) subExpressions[0];
boolean negated = false;
int opIndex = getOperatorIndex();
if (cmpOp.allowsNaN && getOperatorIndex() > NOTEQUALS_OP) {
if (cmpOp.greaterOnNaN... |
300741f1-a6f7-4094-9d2c-e03c1a4fb88f | 5 | public static void print(int[] array) {
int i = 0;
int rowCount = 1;
int indent = array.length;
int spaces = 0;
while (i < array.length) {
indent = (int)Math.floor((float)(indent) / 2.0);
for (int k = indent; k > 0; k--) {
System.out.print(" ");
}
for (int j = rowCount; j > 0 && i < a... |
0c2a3ef0-c019-436e-a557-150f56ed0980 | 6 | public synchronized void initEnemies(int size){
int x = 0 ; // < 800
int y = 0 ; // < 200
Enemy enemy = null ;
Thread thread = null ;
if( size == 1){
}else{
}
for( int i = 0; i<size; i++){ //系统每次初始化size个坦克
if( size == 1){
x = (int)(Math.random() * 700 );
y = (int)(Math.ra... |
7f997561-df71-4617-a793-8a38125da8c1 | 4 | public static String format(double value, int decimal){
String pattern = "0";
switch (decimal){
case 0: pattern = "0";
break;
case 1: pattern = "0.0";
break;
case 2: pattern = "0.00";
break;
case 3: pattern = "0.000";
break;
}
df.applyPattern(pattern);
return df.format(value); ... |
a0f3af0a-4483-4454-82ad-01e3f90b2f23 | 3 | public void playTrack(TrackType track)
{
try {
player = new Player(new BufferedInputStream(new FileInputStream(track.getTrackURL())));
} catch (JavaLayerException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
... |
0c5cb71d-0162-4ce7-ad2b-3407e92b3c27 | 2 | @Override
public Vehicule postVehicule(Vehicule v) throws JSONException,BadResponseException {
Representation r = new JsonRepresentation(v.toJSON());
r = serv.postResource("intervention/" + interId + "/vehicule", v.getUniqueID(), r);
Vehicule vehicule = null;
try {
vehicule = new Vehicule(new JsonRepresent... |
95c7241b-73ac-4845-905a-11d9187b2122 | 0 | public String getTitle()
{
return getManifestMainAttribute(
Attributes.Name.IMPLEMENTATION_TITLE, "unknown"
);
} |
02067671-196b-49f1-92ba-5cb0860c13af | 5 | private int findHeaderEnd(final byte[] buf, int rlen) {
int splitbyte = 0;
while (splitbyte + 3 < rlen) {
if (buf[splitbyte] == '\r' && buf[splitbyte + 1] == '\n' && buf[splitbyte + 2] == '\r' && buf[splitbyte + 3] == '\n') {
return splitbyte + 4;
... |
c0233b99-a115-4ce1-a651-97b162395410 | 9 | public void DBUpdateRoom(Room room)
{
if((!room.isSavable())||(room.amDestroyed()))
return;
if(Log.debugChannelOn()&&(CMSecurity.isDebugging(CMSecurity.DbgFlag.CMROOM)||CMSecurity.isDebugging(CMSecurity.DbgFlag.DBROOMS)))
Log.debugOut("RoomLoader","Start updating room "+room.roomID());
CMLib.map().register... |
c8d8808c-8674-4859-95e8-04198bd2cc0b | 0 | public void clear() {
buffer = new StringBuffer();
cachedHash = 0xdeadbeef;
} |
1708e01a-1974-4d8b-a2a6-808fa6845272 | 5 | public String toString() {
try {
Node domNode = (Node)getUserObject();
String domNodeValue = getNodeValue(domNode);
if(_displayNodeValue && (domNodeValue != null) && (!domNodeValue.trim().equals(""))) {
if(domNode instanceof Attr) {
return ((Attr)domNode).getName() + ": " + domN... |
8a65e514-ec43-4201-9c4c-7f0251e93b65 | 0 | private String printGPS(double a){
return String.format("%.5f", a);
} |
c0545307-dc77-49da-801a-27cb02dc60d3 | 1 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
processRequest(request, response);
} catch (Exception ex) {
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
... |
80dd1aee-91bb-4117-95ec-d83e117be273 | 2 | public static void executeSQL(final String sql, final Object... params) {
synchronized (Lock) {
final DBOpenHelper helper = Beans.getBean(DBOpenHelper.class);
SQLiteDatabase database = helper.getReadableDatabase();
if (params != null && params.length > 0) {
database.execSQL(sql, params);
} else {
... |
57159bb1-da21-43f0-86b3-26d316fad549 | 3 | public UserFrame() {
super("Hibernate user client");
alarms = new ArrayList<Alarm>();
hardwares = new ArrayList<NetworkHardware>();
links = new ArrayList<Link>();
graph = new mxGraph();
graphLayout = new mxCircleLayout(graph);
graphPane = new mxGraphComponent(graph);
propertyTableModel = new ... |
ca3d2d0d-7746-4d53-ae6c-ed40c25ebd4d | 1 | public void mousePressed(MouseEvent event) {
if ((state = controller.stateCreate(event.getPoint())) == null)
return;
getView().repaint();
} |
e2772a46-e5bb-412a-84d6-f84a989dd710 | 3 | @Override
public String toString() {
StringBuilder sb = new StringBuilder("Book(");
boolean first = true;
sb.append("id:");
sb.append(this.id);
first = false;
if (!first) sb.append(", ");
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
sb.appen... |
be717c13-2e25-4935-a2fe-a62946b377f5 | 7 | public Event createEvent(String identifier, ArrayList<Restriction> restrictions, ArrayList<Result> results) {
//We need to create the new Event with the parameters given
Event newEvent = new Event(identifier, restrictions, results);
//Check to see the identifier is unique
for(Event... |
0df1279a-4706-46ab-8bdd-eb6aee799afd | 1 | private void increaseRound() {
if (round <= MAX_ROUND) {
round++;
}
} |
d71d5e18-c927-4666-85e3-214a822f1c9f | 3 | public void reload() {
Main.configurationFile.load();
this.setLoggingLevel();
this.configureRecipientDefaults();
Main.messageManager.enable();
for (final MessageManager instance : MessageManager.instances.values())
if (instance != Main.messageManager)
... |
67f015d4-c1cc-4ff6-9932-c0c5ef45f692 | 3 | @Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... |
5656a125-c6ea-41c2-973e-823341d51cd9 | 4 | public static ArrayList<String[]> TotiActorii()
{
//returneaza actorii din tabelul Personal al bazei de date
ArrayList<String[]> data = new ArrayList<>();
SQLiteStatement queryResult = null;
double brut=0,impozit=0,net=0;
try
{
queryResul... |
2d88c1b7-a7e2-4c33-8061-4ed6c09fc235 | 6 | private boolean camposNecesarios () {
if ((jTextField1.getText().length()==0) ||
(jTextField2.getText().length()==0) ||
(jTextField3.getText().length()==0) ||
(jTextField4.getText().length()==0) ||
(jTextField5.getText().length()==0) ||
(jTextField6.ge... |
4c7f32cf-7070-4521-882f-c5cc9ee1ad7c | 4 | public boolean execute(CommandSender sender, String[] args) {
String groupName = args[0];
Faction group = Citadel.getGroupManager().getGroup(groupName);
if(group == null){
sendMessage(sender, ChatColor.RED, "Group doesn't exist");
return true;
}
String senderName = sender.getName();
if(!group.isFounde... |
777dc849-794b-4401-8217-48c5ee708e31 | 9 | * @param iRow index of row in table
* @param iCol index of column in table
*/
public void setValueAt(Object oProb, int iRow, int iCol) {
Double fProb = (Double) oProb;
if (fProb < 0 || fProb > 1) {
return;
}
m_fProbs[iRow][iCol] = (double) fProb;
double sum = 0;
for (int i = 0; i < m_fProb... |
ff1d26d6-cc63-4ec9-be0e-0131b74600df | 3 | @Override
public void run() {
// TODO Auto-generated method stub
try {
while((message = reader.readLine()) != null && !message.equals(".")) {
System.out.println("Client received message: " + message);
controller.MessageReceived(message);
}
} catch (IOException e) {
// TODO Auto-generated catch b... |
c3a5fa58-33c1-4888-b74f-47ea326d1427 | 9 | private Object handleName(Object tos) {
if ((tos instanceof Generator && ((Generator)tos).getName() == null) ||
(tos instanceof Repository && ((Repository)tos).getName() == null) ||
(tos instanceof Address && ((Address)tos).getName() == null) ||
(tos instanceof Submitter && ((Submitt... |
c0f4eb32-6629-4a85-a566-2026235f1d91 | 8 | @Override
public int compare(Temporal t1, Temporal t2) {
if (null == t1) {
if (null == t2 || Long.MIN_VALUE == t2.startTime) return 0;
return Integer.MIN_VALUE;
} else {
if (t1 == t2) return 0;
if (null == t2) {
if (Long.MIN_VALUE == t1.startTime) return 0;
return Integer.MAX_VALUE;
} else {... |
710cf8a6-3bb6-451e-b802-7cda0d4d8065 | 1 | public static void main(String[] args) throws Exception {
File activeUsers = new File("activeUser.txt");
if (!activeUsers.exists()) {
System.err.println("File " + activeUsers.getAbsolutePath()
+ " does not exist!");
System.exit(0);
}
CalcGraphSize graphCalculator = new CalcGraphSize(activeUsers);
g... |
3839e5b5-1ab8-4db6-afbe-04543c315359 | 2 | @Override
public boolean add(RenderItem item) {
if (maxSize > 0 && renderList.size() >= maxSize) {
throw new IllegalStateException("Render list is full");
}
renderList.addLast(item);
return true;
} |
678da4a0-4fab-4193-be04-79188519a539 | 9 | private static List<Entity> selectItemsByRating(List<Entity> allEntities, String rating) {
if (rating == null || rating.equals("") || rating.equalsIgnoreCase("all")){
return allEntities;
}
List<Entity> ratedList = new ArrayList<Entity>();
if (rating.equalsIgnoreCase("unlike")){
for(Entity e : allEntiti... |
fb56068c-aa09-42fb-9bb8-d5ad79052af1 | 3 | public List<OrdenDeCompra> getListaNumeroOrden(){
List<OrdenDeCompra> lnumero = new LinkedList();
Conexionbd.conexion bd = new Conexionbd.conexion();
ControladorUsuario cont = new ControladorUsuario();
try{
bd.conectarBase();
ResultSet rs = bd.sentencia.executeQuery("... |
cedacf1d-1f30-4619-9da2-86b7114904f5 | 3 | public boolean onSisalla(Sijainti sijainti)
{
return sijainti.x() >= alkupiste.x() && sijainti.y() >= alkupiste.y() && sijainti.x() <= paatepiste.x() && sijainti.y() <= paatepiste.y();
} |
a7170779-807a-4224-95fd-84e535b259a8 | 6 | static double[] moveProbs(int k, double[] capacity, double[][][] graph) {
double[] taueta = new double[NUM_AGENTS];
double sum = 0.0; // sum of all tauetas
for (int i = 0; i < taueta.length; ++i) { // i is the agent in question
if (capacity[i] <= graph[i][k][1]) {
taueta[i] = 0.0; // prob of moving to an ... |
80c20516-4b62-45ba-a225-8fa3df179c67 | 9 | public static void main(String[] args) {
bootstrap = new Bootstrap();
Map<String, String> options = new HashMap<>();
Properties properties = System.getProperties();
Enumeration n = properties.propertyNames();
String k;
while (n.hasMoreElements()) {
k = (String) n.nextElement();
if (k.startsWit... |
4770aaac-5573-4319-9039-7141d3c5228c | 9 | private static String[] readHeaderLines( InputStream is )
throws IOException {
List lineList = new ArrayList();
StringBuffer sbuf = new StringBuffer();
boolean hasChars = false;
for ( int c; ( c = is.read() ) >= 0; ) {
hasChars = true;
switch ( c ) {
... |
0f1d8cad-a351-42eb-a92e-7a256dbb315f | 7 | public synchronized void sendChatEvent(ChatEvent chatEvent) {
/*
* IF CLIENT
*/
if (networkHandler.getProgramState() != null && networkHandler.getProgramState().isRunning() && networkHandler.getProgramState().isClient())
try {
System.out.println("Sending: " + chatEvent);
// See:
// http://stac... |
15b676d8-b1ac-4e85-bfb2-bc521451fd12 | 7 | public void attackPlayer(int attackNo, Vector3f dir){
if(playerAttackCollision()){
BasicInfo bi = getPlayerModel().getControl(BasicInfo.class);
EffectControl ec = getPlayerModel().getControl(EffectControl.class);
if(attackNo == 1){
bi.decreaseHP(d... |
b7ec75c0-3b79-483f-9cab-90891eb7adda | 4 | @SuppressWarnings({"empty-statement", "CallToThreadDumpStack"})
private void miMaterialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miMaterialActionPerformed
if (getCadMaterial() != null && !cadMaterial.isVisible()) {
deskPane.remove(getCadMaterial());
setCadMa... |
0fd84742-8a7d-4e9f-832a-783b93e813b7 | 0 | @Override
public boolean isInfrastructure() { return true; } |
010167a7-f77e-48fc-982f-bd5773440423 | 3 | public static void main(String[] args) {
int N = Integer.parseInt(args[0]);
if (args.length == 2) StdRandom.setSeed(Long.parseLong(args[1]));
double[] t = { .5, .3, .1, .1 };
StdOut.println("seed = " + StdRandom.getSeed());
for (int i = 0; i < N; i++) {
StdOut.printf... |
7817a643-18bd-4d03-b479-03d2ed59a0d3 | 0 | public void update(TestBean bean) {
jdbcTemplate.update("update TEST SET NAME = ? where id = ? ",
bean.getName(), bean.getId());
} |
a21f4f73-c467-43c6-90ea-033101dcbc6d | 3 | public static void main(String[] args) {
if (args.length == 0) {
System.out.println("usage: java Sobel imagefile [iterations] [RLE]");
System.out.println(" imagefile is an image in TIFF format.");
System.out.println(" interations is the number of blurring iterations" +
... |
c8ad8f99-f588-4573-a09d-00fed66955e6 | 8 | public Netlist buildNetlist() {
for (EvlModule evlModule : evlModules) {
for (Map.Entry<String, Integer> wire : evlModule.getWiresSet()) {
if (wire.getValue() == 1) {
builder.addNet(wire.getKey());
} else if (wire.getValue() > 1) {
for (int i = 0; i < wire.getValue(); i++) {
builder.addNet(... |
387b1e95-bb2c-462c-8c3d-660d837b82f7 | 4 | public static void editMeetingRoom(MeetingRoom mr){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(fal... |
edff3851-72e8-49b4-9faa-ee93f92a1458 | 4 | public void run() {
Client pathinfoClient = new FileServerClient("Camera-Request",
"Camera-Response");
CameraCaptureRequest message = new CameraCaptureRequest();
System.out.println("Sending ...");
MessageAdaptor response = pathinfoClient.sendAndWait(message);
if (response instanceof CameraCaptureRespons... |
8316bd4e-0d90-49ce-9214-027f4d1de22e | 7 | public AsyncHttpClient() {
BasicHttpParams httpParams = new BasicHttpParams();
ConnManagerParams.setTimeout(httpParams, socketTimeout);
ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(maxConnections));
ConnManagerParams.setMaxTotalConnections(httpParams, DEF... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.