method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3ba39b57-67c1-4342-a28a-33cf243695a3 | 0 | @Override
public void mouseEntered(MouseEvent paramMouseEvent) {/**/} |
f505c4d9-bb56-4081-8233-069926fe10a6 | 7 | private void diffOffering(ArrayList<Change> list, OffRec oldRecord,
HashMap<String, Object> session) {
String newString = (String) session.get("homeLink");
if (Change.fieldChanged(oldRecord.getLink(), newString))
list.add(OfferingChange.setLink(oldRecord, newString));
boolean newActive = (Boolean) session.g... |
a96320a7-0904-4ad2-befc-161d518a2653 | 0 | public int next() {
lock.lock();
try {
++currentEvenValue;
Thread.yield(); // Cause failure faster
++currentEvenValue;
return currentEvenValue;
} finally {
lock.unlock();
}
} |
aef7b3df-610b-4889-a04e-1f9bb97bec2f | 9 | public static void start(String username, String ip) throws Exception {
String title = "Network Communicator : " + username;
final String name = username;
final int port = 6000;
String IP = ip;
final JFrame frame = new JFrame(title);
JPanel contentPane = new JPanel(new B... |
9031cfe0-a0d3-457e-b0ca-fd9e4bb564c8 | 3 | public void addItem(Object obj, String name)
{
WidgetChooserButton button;
if (checkable && selectedNo != -1) {
button = (WidgetChooserButton)(layout.itemAt(selectedNo).widget());
button.setChecked(false);
}
button = new WidgetChooserButton(obj, name, true);
if (checkable) {
button.setCheckable(t... |
977b9f59-8191-4dd0-a79e-56b31c7e38f1 | 6 | private void listaArgumentos() {
// <lista_argumentos> ::= <argumento> <prox_argumento> | “vazio” “)”
// <prox_argumento> ::= “,” <argumento> <prox_argumento> | ")"
// <argumento> ::= <id> <compl_tipo_parametro>
// <compl_tipo_parametro> ::= <acesso_campo_registro> | <acesso_matriz>
// ... |
9f32f988-6ca4-4114-917b-62795736c88a | 1 | public String[] UDP2String(Packet packet) { //Creates a string array with udpPackets
UDPPacket udpPacket = (UDPPacket) packet; //Creates a udp packet out of the packet
EthernetPacket ethernetPacket = (EthernetPacket) packet.datalink;
//Creates and ethernet packet for layer 2 information
src_macInEnglish = e... |
b108a4e9-2bcd-40d2-aeea-962fa7034a0b | 6 | public void joinChannel(Player p, String channelName) {
// Sanity-Check..
if (!ChannelsConfig.getChannels().contains("channels." + channelName)) {
Messenger.tell(p, Msg.CUSTOM_CHANNELS_NULL);
return;
}
// Make sure channel is joinable, or if a player has a bypass permission.
if (isJoinable(channelNam... |
966ead14-9fa0-4fda-a5ea-c3128d9acc73 | 2 | protected Calendar getCalendarFromArg(String dateString) {
Calendar result = null;
if (banUntilDate) {
try {
result = Calendar.getInstance();
result.setTime(banDateParser.parse(dateString));
} catch (ParseException e) {
log.log(Leve... |
800ef22e-5313-47ab-a30d-6b971dbe6c79 | 7 | public static void openURL(String url) {
String os = System.getProperty("os.name").toLowerCase();
Runtime rt = Runtime.getRuntime();
try {
if (os.indexOf("win") >= 0) {
rt.exec("rundll32 url.dll,FileProtocolHandler " + url);
} else if (os.indexOf("mac") >= 0) {
rt.exec("open " + url);
} else if... |
eb2d3ade-dc8f-406d-b21c-0a64b2c991dc | 8 | @Override
protected void drawInternalU(UGraphic ug, Area area, boolean withShadow) {
final Dimension2D dimensionToUse = area.getDimensionToUse();
final StringBounder stringBounder = ug.getStringBounder();
final int textHeight = (int) getTextHeight(stringBounder);
ug.getParam().setColor(getForegroundColor());
... |
406ef7fc-ab85-427b-9c81-d4c1b1e0e50f | 5 | public static boolean containsSubstring(final String[] arr, String search) {
if (search == null)
return false;
search = search.toLowerCase();
for (String s : arr) {
if (s == null) continue;
s = s.toLowerCase();
if (s.contains(search) || search.contains(s))
return true;
}
return false;
} |
f1a0d29e-bd03-40b6-bc48-1a902643afc6 | 1 | private void doubleArray() {
Object[] tempArray = new Object[array.length * 2];
for (int i = 0; i < size(); i++) {
tempArray[i] = array[i];
}
array = tempArray;
} |
de88cac3-49ec-42cb-a3b7-f1af4e1e22cc | 0 | public void setConsignmentId(int consignmentId) {
this.consignmentId = consignmentId;
} |
2cb4e148-3413-4fc2-b85b-9a52ef9b779b | 0 | public String getIpAddress() {
return this.ipAddress;
} |
ea6e3be1-5eb2-4e63-ba78-74eeda8512d4 | 9 | public BufferedImage[] getPaintImages(String theme) {
BufferedImage[] images = null;
String line;
ArrayList imageNames = new ArrayList();
try {
InputStream in = getClass().getResourceAsStream(GameController.CONFIG_DIR + config);
BufferedReader br = new BufferedRe... |
b800a9b0-1a91-4666-b423-a01f0bd7fd86 | 9 | public LinkedList<Diff> diff_lineMode(String text1, String text2,
long deadline) {
// Scan the text on a line-by-line basis first.
LinesToCharsResult b = diff_linesToChars(text1, text2);
text1 = b.chars1;
text2 = b.chars2;
List<String> linearray = b.lineArray... |
7b30315e-c515-437b-b57b-85b3eb8728ad | 6 | public static String unescape(String string) {
int length = string.length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; ++i) {
char c = string.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < length) {
... |
9a143f6b-9de3-4d06-ac83-820271b62114 | 5 | void NNIupdateAverages( double[][] A, edge e, edge par, edge skew,
edge swap, edge fixed )
{
node v;
edge elooper;
v = e.head;
//first, v
A[e.head.index][e.head.index] =
(swap.bottomsize*
((skew.bottomsize*A[skew.head.index][swap.head.index]
+ fixed.bottomsize*A[fixed.head.index][swap.head.ind... |
28a20f51-24ab-43aa-9912-e691176297ef | 2 | private boolean cmdGlobalRules(CommandSender sender) {
try {
String[] rules = WebUtils.readContentsToArray(new URL("http://server.mcforge.net/gcrules.txt"));
for (int i = 0; i < rules.length; i++) {
sender.sendMessage(rules[i].replace('&', ChatColor.COLOR_CHAR));
}
rules = null;
}
catch (IOExcept... |
b7c73183-cf04-4b3d-8f9f-28592cafdbc4 | 2 | private void append(int x, int y, String s)
{
if (!isValidPosition(x,y))
return;
if (!w[x][y].contains(s))
{
w[x][y] += s;
}
} |
154ef9ff-ae7b-49f1-96d3-9598104d0e3d | 7 | public void simulateOneStep()
{
step++;
// Provide space for newborn actors.
List<Actor> newActors = new ArrayList<Actor>();
// avoid being being interrupted
try{
if (actors != null)
{
// Let all actors act.
for(Iterator<Actor> it... |
f699fda5-9608-4284-b8a8-4574e9d1c921 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-YOUPOSS> sk... |
861671a0-c92e-4b9d-85a5-f9766fcafec7 | 1 | public List<Recipe> getRecipeList() {
if (recipeList == null) {
recipeList = restClientBean.getRecipeClient().getAll();
}
return recipeList;
} |
da9eb31a-8fa8-42d2-866f-482a9c54a74b | 8 | public void render(Screen screen) {
if (Player.target != null) {
if (!Player.target.removed) {
screen.renderItem(Player.target.x - 16, Player.target.y - 16, Sprite.crosshairs);
} else {
Player.target = null;
}
}
//Drawing a circle:
if (Player.aiming) {
screen.renderItem(Mouse.mse.x - 16, M... |
4674bfff-a23d-4b4e-8657-d6966f748d8e | 7 | public static void main(String[] args) throws IOException,
AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException
{
Instance mock = new MockInstance();
Connector connector = mock.getConnector("root", new PasswordToken(
new b... |
b3f7c410-623b-4e91-8401-09d3c70bde78 | 9 | @Override
public void execute(CommandSender sender, String[] args)
{
if(args.length == 1) {
if(args[0].equalsIgnoreCase("version") || args[0].equalsIgnoreCase("ver")) {
//output version
PluginDescription desc = MojangStatus.getInstance().getDescription();
sender.sendMessage(ChatColor.DARK_AQUA + (Cha... |
0d51fb22-851e-450c-b0fa-12123032619f | 5 | public void insertItem (int val) {
if (root==null) root = new Leaf(val);
else {
Leaf temp = root;
while (true) {
if (val <= temp.value) {
if (temp.left != null) temp=temp.left;
else {
temp.left = new ... |
c8d9d6ac-9983-4c31-ab86-93009ca2c692 | 7 | public void crearPublicacion(){
ccp = new ControlCrearPublicacion();
//La funcion trim() elimina espacios antes y despues del valor
String tpub = thisRequest.getParameter("tPub").trim();
String tit1 = thisRequest.getParameter("tArt1").trim();
String tit2 = thisRequest.getParameter("tArt2").trim();
... |
0b837232-9cf5-4bf5-affb-fca5336a6da1 | 1 | public static boolean isEmpty(Object[] array) {
return (array == null || array.length == 0);
} |
b2ffc2c8-2377-414d-9870-f0959df5fc2e | 7 | private void formScreen(String action,
Connection database,
HttpSession session,
HttpServletRequest request,
PrintWriter webPageOutput)
{
int descriptionNumber=0;
String description="";
Routines.tableStart(false,webPageOutput);
if("Change Description".equals(action))
... |
37ffbb49-2415-45d6-9a29-5a7820321c39 | 9 | public final void run() {
runningThread = Thread.currentThread();
String threadNameOriginal = runningThread.getName();
if (threadNameOriginal == null) threadNameOriginal = "T" + getClass().getSimpleName();
if (threadName != null && !threadName.isEmpty()) runningThread.setName(threadName);
else threadName =... |
89ea1743-336f-4d84-b0fe-64b8c1257024 | 8 | public void genOperationToRConversion(StringBuffer buff, Operation o) {
StringBuilder funcbuff = new StringBuilder();
// R operation
funcbuff.append(String.format("r.%s<-function(", o.name));
if (o.parameters != null) {
Request r = o.parameters.request;
if (r.par... |
9ef327eb-9a58-442c-9614-ec0923795b03 | 0 | public static void main(String[] args) {
System.out.println(Byte.MIN_VALUE); // 127
System.out.println(Byte.MAX_VALUE); // -128
System.out.println(Short.MIN_VALUE); // 32767
System.out.println(Short.MAX_VALUE); // -32768
System.out.println(Integer.MIN_VALUE); // 2147483647
System.out.println(Int... |
d4b3405d-e575-49ff-bf04-784d47dd92c3 | 8 | public static boolean hasAtLeastOneMethodWithName(Class<?> clazz, String methodName) {
Assert.notNull(clazz, "Class must not be null");
Assert.notNull(methodName, "Method name must not be null");
Method[] declaredMethods = clazz.getDeclaredMethods();
for (Method method : declaredMethods) {
if (method.getName... |
a0f6a431-f7f3-4612-8cf5-9de8beacbf32 | 2 | public MongoClient abrirConexion()
{
if(mongo != null)
{
return mongo;
}
try
{
mongo = new MongoClient(host, puerto);
db = mongo.getDB(nombredb);
}
catch (UnknownHostException e)
{
e.printStackTrace();
}
return mongo;
} |
edef3371-a5b3-492a-8e66-244163e253b4 | 0 | public static Point invertDirection(Point direction) {
Point newDirection = (Point) direction.clone();
newDirection.x *= -1;
newDirection.y *= -1;
return newDirection;
} |
af05c025-102a-4954-a00d-847a036ad5bc | 0 | public void setPaniculata(int paniculata) {
this.paniculata = paniculata;
} |
98e67103-d8d4-45fc-bbac-d5ab2b196088 | 7 | public synchronized void stepOut()
{
// First we run until the current frame has been evaluated.
// Note that we keep holding on to the same frame for testing,
// the one that was on the top when this method was called.
final Eval2.StackFrame lFrame = getStack().top();
stepcount = ... |
c7d52b63-a6e5-4afe-a066-d4848cf932a8 | 4 | @Test
public void testEmptyArray() {
Conversions.debug = debug;
double[] arr = Conversions.convert("{}", double[].class);
Assert.assertTrue(arr != null && arr.length == 0);
arr = Conversions.convert(" { } ", double[].class);
Assert.assertTrue(arr != null && arr.length == 0);
arr = Conversions.convert(" {} ... |
5fd76175-8912-43fd-9e2f-48336d6c7986 | 1 | @Override
public void handleOpenEndedAt( int x, int y ) {
if( !itemShown ){
itemShown = true;
parent.addItem( line );
}
line.setPoint2( x, y );
} |
ce435263-a02b-404a-8af4-3219dec68eec | 4 | public static void deleteDups2(LinkedListNode n) {
if(n == null)
return;
for(LinkedListNode i = n ; i.next != null ; i = i.next) {
int original = i.val;
for (LinkedListNode j = i; j.next != null;) {
if(j.next.val == original)
j.next = j.next.next;
else
j = j.next;
}
}
} |
57d9e9d3-2b30-48a5-8bc3-46da0ca5b628 | 4 | public void update()
{
for(Entity entity : this.entities)
entity.update();
this.player.update();
for(int i = 0; i < this.entities.size(); i++)
if(this.entities.get(i).shouldRemove)
{
this.entities.remove(i);
i--;
}
this.lifetime++;
if(this.player.gifts == this.KIDS)
{
Game.inst... |
5dcca5f8-0161-41d4-a3c7-65dd35fecffc | 8 | public void run() {
try{
while (!client.isClosed()) { // while client is not closed
String messageToSend;
synchronized(client) {
messageToSend = client.getMessageOut(); // Get the message
client.setMessageOut("");
}
if (client.isClosed()) // Check again if client is closed... |
ec8cbe63-c1a1-40e3-b2d0-6217a70f8202 | 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... |
e2be421c-78d7-4266-a2e1-074c25d8e19c | 2 | public ArrayList<Tile> getAdjacentTiles(Tile tile)
{
ArrayList<Tile> adjacentTiles = new ArrayList<Tile>();
for (Direction direction : Direction.values()) {
Tile nextTile = getTile(tile.getGridX() + direction.getXOffset(), tile.getGridY() + direction.getYOffset());
if (nextTile != null) { //null implies that... |
18e2b818-07aa-4c28-aa47-7ab12ea9a8f6 | 2 | public void addQuizText(String title,int quizId,ArrayList<String> imageList, ArrayList<Boolean> imageInventoryList,ArrayList<String> soundList,
ArrayList<Boolean> soundInventoryList, int narration,
String paragraphList, String preNote, String postNote,String goTo, int points, String date, ArrayList<String> ... |
072e7f3f-b70e-4c9c-98c8-a8eb1b252d2e | 3 | @Override
public String confirmationMessage()
{
Entity e = editor.getMap().getEntityList().getEntityWithUUID(u);
String name = e.name;
if(name.equals(""))
name = "Untitled";
String ret = "Are you sure you would like to edit "+name+"?";
if(e.getPrefabPath() != null)
ret += " This entity is currently a... |
eed33ff0-63f9-43f0-aa51-17e86b32d678 | 0 | public UDPThread(DatagramSocket socket,int size) {
this.socket=socket;
this.size=size;
} |
5afca204-8649-4c92-8287-a35beafdbea9 | 4 | private void updateStateRecipeName(List<Keyword> keywords, List<String> terms) {
RecipeLearningState nextState;
//TODO recipe already exists
if (terms.size() > 0) {
//I doubt that this code will work, what if last dialog was RA but the user just wants to teach the robot
//a new recipe -> further modification nee... |
84d837ee-63ef-44e4-9b10-15099f40c269 | 5 | public double[] solve(double[] rowValues){ // FIGURE OUT HTF THIS WORKS
double A[][] = this.clone().elements;
double[] values = new double[this.rowCount];
int N = rowValues.length;
for (int k=0; k<N; k++){
int max = k;
for (int i = k+1; i<N;i++){
i... |
b98ed4ee-27d7-4f66-aa7a-c5b57afefe37 | 3 | public static void fix(int[] values) {
int aux = 0;
for (int i = 0; i < values.length; i++)
values[i]--;
if (values[1] > values[3]) {
aux = values[1];
values[1] = values[3];
values[3] = aux;
}
if (values[0] > values[2]) {
aux = values[0];
values[0] = values[2];
values[2] = aux;
}
} |
02e49e96-2633-4b6e-b88e-600a8fdc1b70 | 0 | public Map<MetaEnum, Object> getMeta() {
return meta;
} |
7b169ab2-663c-4dc5-bc6a-fdfcecb20a15 | 7 | private void setControl(byte val) {
// System.out.println("SetControl:" + ByteFormatter.formatBits((byte)val));
chr4KMode = ((val & 0x10) == 0x10);
int prgMode = ((val >> 2) & 0x3);
if (prgMode < 2) {
using32PRGBank = true;
lowBankFixed = false;
} else if (... |
1164d216-11d1-4fda-8155-379ad7953111 | 7 | protected void disconnectInterface( String hostId, String ifId ) {
Host h = hosts.get( hostId );
if( h == null ) return;
String linkId = h.interfaceLinkIds.get(ifId);
if( linkId == null ) return;
Link l = links.get(linkId);
if( l != null ) {
if( hostId.equals(l.host1) && ifId.equals(l.if1) ) {
l.host... |
5bf26df4-7ba5-4852-80da-36d639f840a0 | 7 | private Object setValueByType(String param, Class paramType){
if(paramType == String.class){
return param;
}else if(paramType == char.class){
return Character.valueOf(param.charAt(0));
}else if(paramType == short.class){
return Short.valueOf(param);
}else if(paramType == int.class){
return Integer.v... |
4c80bf8e-e615-4166-8f9f-988321366850 | 3 | public Type checkType(TypeMap tm)
{
Type t = new Type();
t.typeid = Type.TypeEnum.t_error;
Type tmp = e.checkType(tm);
if(tmp.OK())
{
if(tmp.typeid == Type.TypeEnum.t_pair)
{
t.typeid = tmp.t2.typeid;
}
else
{
if(Type.isDebug)
{
System.out.println("TypeError! snd: "+tmp.typeid... |
3581f4a7-0aa4-4c8a-a780-b01924f79631 | 6 | public final void initializeLookAndFeels() {
// if in classpath thry to load JGoodies Plastic Look & Feel
try {
LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels();
boolean found = false;
for (int i = 0; i < lnfs.length; i++) {
if (lnfs[i].ge... |
2f28eda0-9132-4df3-b3df-c0c1ca936b39 | 4 | private JSONObject parseResponse(final String query) throws NameResolverException {
assert query != null;
LOG.log(Level.INFO, "Call IAS name resolver: {0}", query);
final ClientResourceProxy proxy = new ClientResourceProxy(query, Method.GET);
final ClientResource client = proxy.getClientResource();
... |
c407ab2a-114a-4808-a3ac-e26028eb3deb | 9 | @Override
public void run() {
if(game != null) {
final Color color;
final PlayerStatus status;
if(game.getWinner() != Player.NONE) {
color = UIPlayer.getPlayer(game.getWinner()).getForeground();
status = game.getPlayerStatus(game.getWinner());
}
else {
color = UIPlayer.getPlayer(game.getCu... |
2d727e13-3c23-4c15-8152-9301a6741e28 | 3 | @Override
public void caseAIdentifier(AIdentifier node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(Identifier[ " + node + "]");
inAIdentifier(node);
if(node.getId() != null)
{
node.getId().apply(this);
}
... |
4874b11c-c20c-46e6-812c-298b28c6193f | 1 | @Override
public Boolean call() throws IOException {
InputStream is = null;
is = updateURL.openStream();
prop.load(is);
String version = prop.getProperty("version");
int currentVersion = (normalizeVersion(version));
int runningVersion = (normalizeVersion(GrooveJaar.version));
/*for (byte i =0;i<runn... |
25231b23-f076-4e48-818a-701eeba6fa0f | 1 | public UIFile(Path uitextfile, Path script, Path authuiTmp, Path basebrdTmp) {
if (!FileUtil.control(uitextfile)) {
IllegalArgumentException iae = new IllegalArgumentException("The uitextfile must not be null!");
Main.handleUnhandableProblem(iae);
}
this.authuiTmp = auth... |
75cf0e6a-c448-4860-b564-23672f3b435f | 1 | public void alertObservers(Event e) {
for (ColorObserver co : wantsToKnow) {
System.out.println("Alerted.");
co.alert((ColorEvent) e);
}
} |
6c07d23e-6ae7-4fd4-aea6-713ee50973fd | 8 | private void restore(int start, String[] ip, int curNum, String s) {
if (start > s.length() || curNum >= 4) {
return;
}
if (curNum == 3) {
String last = s.substring(start);
if (isValid(last)) {
ip[3] = last;
String oneResult = "";
for (int i = 0; i < ip.length; i++) {
oneResult += String... |
eed32a73-67b3-460e-a35c-a0c0c01fcaaf | 3 | public void go_temps_reel(){
new Thread(){
public void run(){
while(!terminer){
//si il y a de nouveaux messages dans la file depuis la derni�re mise � jour :
if (dernier_nb_messages != filemessages.size()) {
vue.maj();
}
dernier_nb_messages = filemessages.size();
try {
... |
619bbe83-00e5-4d61-9b93-77d9aa614f2e | 1 | public static boolean isTresspass(int s) {
if(s==52465)
return true;
return false;
} |
cd302fac-9a74-4edd-8425-2165320a3e77 | 8 | private Object getValue(Field field) throws Throwable {
field.setAccessible(true);
Class<?> type = field.getType();
if (type == int[][].class) {
return Arrays.toString((int[][]) field.get(this));
} else if (type == int[].class) {
return Arrays.toString((int[]) field.get(this));
} else if (type == byte[]... |
fcc9da1a-8c92-4951-8ee0-95b8d61d17f8 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SymbolicName other = (SymbolicName) obj;
if (attributes == null) {
if (other.attributes != null)
return false;
} else if (!attributes.eq... |
c27dc89b-0483-44d8-8445-d79b53680fb2 | 6 | public List<StudentObj> getStudentNotSubmitted(String classname, int objId, int topicId) {
List<StudentObj> items = new LinkedList<StudentObj>();
String sql = "select Student.classname, Student.rollNo, fullname, email from Student inner join Class on Student.classname = Class.classname "
... |
8f69e7db-31ae-4061-bcdf-ff1145e96041 | 9 | void takeBack() {
//Step 1: Reset sides.
side ^= 1;
xside ^= 1;
//Step 2: Using our history values, reset the piece, color an board states.
--hply;
Project2_Move_Thompson m = histDat[hply].m;
castle = histDat[hply].castle;
ep = histDat[hply].ep;
fifty = histDat[hply].fifty;
color[(int)m.from] = side;
if... |
59ebf1af-87a9-4688-aa62-70770e3a724e | 4 | private static int areaWasted(Rectangle first, Rectangle second) {
if (first.width > 0 && first.height > 0 && second.width > 0 && second.height > 0) {
long combinedArea = (long) first.width * (long) first.height + (long) second.width * (long) second.height;
Rectangle union = first.union(second);
long unionAr... |
4099ddad-d6d9-42e4-a334-6850b61e4d59 | 4 | public void actionPerformed(ActionEvent e) {
//Handle open button action.
if (e.getSource() == openButton) {
int returnVal = fc.showOpenDialog(FileChooserDemo.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
... |
2f5e9a47-5189-458c-be8b-69f245bdf5ba | 3 | public Object getValueAt(int row, int column) {
Variable variable = variableList.get(row);
if (column == 0) {
return variable.getName();
} else if (column == 1) {
return variable.getReplacementName();
} else if (column == 2) {
return variable.isObfuscable();
}
return null;
} |
82f427f6-b67e-4360-b176-e2cefd559d11 | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((janela == null) ? 0 : janela.hashCode());
result = prime * result + ((luigi == null) ? 0 : luigi.hashCode());
result = prime * result + ((mario == null) ? 0 : mario.hashCode());
return result;
} |
a5702ff5-7102-44d4-a0ed-ba42187f55df | 0 | public GrammarToAutomatonConverter() {
} |
0da391c9-eb25-4759-ba81-2d6d018eb10d | 4 | int wrap(Graphics g, int width, ArrayList<String> list) {
int lastNewLine = 0, lastSpace = 0, w = 0, maxw = 0;
for (int i = 0; i < info.length(); ++i) {
if (info.charAt(i) == ' ') {
w += g.getFontMetrics().stringWidth(info.substring(lastSpace, i + 1));
... |
f5aedd11-6656-4589-a89c-191403b52076 | 8 | void eliminates(K data) {
if (data == getRoot().data &&
getRoot().right == null &&
getRoot().left == null) {
root = null;
} else {
AVLNode<K> nodetoremover = nodeToRemover(data, getRoot());
System.out.println("Nodo a eliminar " + node... |
6866a157-748d-47b2-8f37-516290c0592f | 6 | private static String fromTime(long time) {
int days = (int) TimeUnit.MILLISECONDS.toDays(time);
int hours = (int) TimeUnit.MILLISECONDS.toHours(time - TimeUnit.DAYS.toMillis(days));
int minutes = (int) TimeUnit.MILLISECONDS.toMinutes(time - TimeUnit.DAYS.toMillis(days) - TimeUnit.HOURS.toMillis(hours));
int se... |
bd714afb-8ffc-457b-a8ce-ca765e3553d4 | 9 | private String ensureFilterType(){
String filterType = null;
if(EQ.startsWith(filterName)){
filterType = EQ;
}else if(LT.startsWith(filterName)){
filterType = LT;
}else if(GT.startsWith(filterName)){
filterType = GT;
}else if(CONTAINS.startsWith(filterName)){
filterType = CONTAINS;
}else if(EMPT... |
ecb0c6b4-0563-4d1a-a30f-f62fcc0413b7 | 8 | protected static String getSyncedDelayString(StructStorageStat[] storageStats, StructStorageStat currentStorageStat) {
long maxLastSourceUpdate = 0;
for (StructStorageStat storageStat : storageStats) {
if (storageStat != currentStorageStat && storageStat.getLastSourceUpdate().getTime() > max... |
aa5c0c18-9961-409f-8232-6179eb750276 | 9 | @Override
public boolean processEndTag(String tag)
{
boolean ready = false;
Boolean inSituationRecord = inTagMap.get(TrafficData.TAG_SITUATION_RECORD);
if (inSituationRecord != null)
{
if (tag.equals(TrafficData.TAG_SITUATION_RECORD))
{
ready = true;
}
else if (inSituationRecord && tag.e... |
d1f375c7-ba58-4be4-b5c9-2059809b80c6 | 5 | public void toggleKey(int KeyCode, boolean isPressed) {
if (KeyCode == KeyEvent.VK_W) {
up.toggle(isPressed);
}
if (KeyCode == KeyEvent.VK_S) {
down.toggle(isPressed);
}
if (KeyCode == KeyEvent.VK_A) {
left.toggle(isPressed);
}
if (KeyCode == KeyEvent.VK_D) {
right.toggle(isPressed);
}
if(... |
52e7aaf2-8c86-40bc-a3e7-7aa7edead2c2 | 5 | public List<Double> readPointFrames(File svlFile) {
List<Double> pointFrames = new ArrayList<>();
BufferedReader fReader = null;
try {
fReader = new BufferedReader(new FileReader(svlFile));
String data = "";
int index = 0;
while((data = fReader.readLine()) != null) {
if (data.contains("<poin... |
a493727c-113f-4991-88b8-e4cc69edb9ee | 2 | @Override
public int hashCode() {
int hashKey = key != null ? key.hashCode() : 0;
int hashValue = value != null ? value.hashCode() : 0;
return (hashKey + hashValue) * hashValue + hashKey;
} |
0175482d-fc33-4c0e-bb8f-b29bbf7b90c3 | 7 | public boolean solapamentTeoriaPractica(Element e) {
boolean grupTeoria = false;
if ((e.getGrupo() % 10) == 0) {
grupTeoria = true;
}
for (int i = 0; i < assignacions.size(); ++i) {
if (assignacions.get(i).getAssignatura().equals(e.getAssignatura())) { // si es la... |
c2b5a22f-b6de-4bc0-938e-3335278df3bf | 7 | private void MonthBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MonthBoxActionPerformed
int m = MonthBox.getSelectedIndex() + 1;
int y = YearBox.getSelectedIndex() + (Calendar.getInstance().get(Calendar.YEAR) - CountYears);
int n = m !=... |
d6e210ce-8ff3-4f61-bfc1-224bb317c6d7 | 3 | private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this);
if ((clipboardContent != null)
&& (clipboardContent.isDataFlavorSupported(DataFlavor.str... |
b3127851-478f-4bcf-b48c-16b589183633 | 2 | public void undo(CardPanel panel) {
System.out.println(history);
if (!history.isEmpty()) {
CardMove toUndo = history.peek();
if (toUndo.undo(this, panel)) {
history.pop();
}
}
} |
a90dfa02-d9ff-4685-9e8c-8135ee5de863 | 4 | public void render(Screen screen){
for(int y = 0; y < (screen.height / 32) + 32; y++){
for(int x = 0; x < (screen.width / 32); x++){
screen.renderTile(x * 32, y * 32, -1, Tile.rockTile);
}
}
font.render("Character Select", -1, 10, 0xffffffff, 2, true, screen);
for(int i = 0; i < 3; i++){
rend... |
87e1ba1e-c0a3-4ad8-a343-62fc91238681 | 6 | @NotNull
public static Expression parse(@NotNull String expression) {
ImmutableList.Builder<Label> includes = ImmutableList.builder();
ImmutableList.Builder<Label> excludes = ImmutableList.builder();
String[] split = expression.split("\\s+");
if(split != null && split.length > 0) {
for (String labelString ... |
b122aae1-dce2-4762-a8a7-764760735368 | 7 | private int handleException(Exception e) {
int errno;
e.printStackTrace();
if (e instanceof FuseException) {
errno = handleErrno(((FuseException) e).getErrno());
if (log != null && log.isDebugEnabled()) {
log.debug(e);
}
} else if (e i... |
2c3f178b-527c-414c-9841-728cd25c7e4f | 9 | public static double[][] FrequencyDomain(double[] x) {
double[] y = new double[x.length];
int m = (int) (Math.log(x.length) / Math.log(2));
int n, i, i1, j, k, i2, l, l1, l2;
double c1, c2, tx, ty, t1, t2, u1, u2, z;
n = x.length;
i2 = n >> 1;
j = 0;
// adapted from Paul Bourke's implementation
// of ... |
4bfc91ca-3da0-4dac-be6a-57a73691e6c2 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
d677d1af-717b-4f3a-a94f-5cf66decef30 | 2 | public int smallestMultiple() {
boolean found = false;
int smallestMultiple = 0;
for (int i = 2520; !found; i++) {
if (isEvenlyDivisible(i)) {
found = true;
smallestMultiple = i;
}
}
return smallestMultiple;
} |
ffb46a96-c73c-44c7-a210-b094ebd973f8 | 0 | @Override
public void close() throws IOException {
super.close();
s.close();
} |
8823c088-9a77-4d63-ab55-3f23957238bd | 8 | public void startGather(Vector x, DistVector y) {
if (x.size() != y.size())
throw new IllegalArgumentException(
"Vectors must be of the same global size");
// Assemble the arrays to send
for (int i = 0; i < comm.size(); ++i)
if (i != comm.rank())
... |
d32ff0d4-eefa-4b6b-9c7a-dc9ccc88b685 | 5 | public static String shortToLong( String name, Map<String,String> nsAbbreviations ) throws XMLParseException {
int lo = name.indexOf(':');
String nsShort, subName;
if( lo == -1 ) {
nsShort = "";
subName = name;
} else if( lo < 1 || lo == name.length()-1 ) {
throw new XMLParseException("Can't parse '" +... |
af03842d-9bf8-4758-8ea9-a2d6c4be9a90 | 3 | public Direction getFacing() {
return (isMoving() || isCancelingMove() || isRecoveringFromCanceledMove() ? moveDirection : facingDirection);
} |
05ac8480-d33c-41f3-a000-7c485b7d431c | 6 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.