text
stringlengths 14
410k
| label
int32 0
9
|
---|---|
public void drawRedderImage(Graphics2D g2d, BufferedImage im,
int x, int y, float brightness)
// using LookupOp
/* Draw the image with its redness is increased, and its greenness
and blueness decreased. Any alpha channel is left unchanged.
*/
{ if (im == null) {
System.out.println("drawRedderImage: input image is null");
return;
}
if (brightness < 0.0f) {
System.out.println("Brightness must be >= 0.0f; setting to 0.0f");
brightness = 0.0f;
}
// brightness may be less than 1.0 to make the image less red
short[] brighten = new short[256]; // for red channel
short[] lessen = new short[256]; // for green and blue channels
short[] noChange = new short[256]; // for the alpha channel
for(int i=0; i < 256; i++) {
float brightVal = 64.0f + (brightness * i);
if (brightVal > 255.0f)
brightVal = 255.0f;
brighten[i] = (short) brightVal;
lessen[i] = (short) ((float)i / brightness);
noChange[i] = (short) i;
}
short[][] brightenRed;
if (hasAlpha(im)) {
brightenRed = new short[4][];
brightenRed[0] = brighten;
brightenRed[1] = lessen;
brightenRed[2] = lessen;
brightenRed[3] = noChange; // without this the LookupOp fails
// which is a bug (?)
} else { // not transparent
brightenRed = new short[3][];
brightenRed[0] = brighten;
brightenRed[1] = lessen;
brightenRed[2] = lessen;
}
LookupTable table = new ShortLookupTable(0, brightenRed);
LookupOp brightenRedOp = new LookupOp(table, null);
g2d.drawImage(im, brightenRedOp, x, y);
} // end of drawRedderImage() using LookupOp
| 5 |
public static Rectangle2D createRectangle(final Size2D dimensions,
final double anchorX,
final double anchorY,
final RectangleAnchor anchor) {
Rectangle2D result = null;
final double w = dimensions.getWidth();
final double h = dimensions.getHeight();
if (anchor == RectangleAnchor.CENTER) {
result = new Rectangle2D.Double(
anchorX - w / 2.0, anchorY - h / 2.0, w, h
);
}
else if (anchor == RectangleAnchor.TOP) {
result = new Rectangle2D.Double(
anchorX - w / 2.0, anchorY - h / 2.0, w, h
);
}
else if (anchor == RectangleAnchor.BOTTOM) {
result = new Rectangle2D.Double(
anchorX - w / 2.0, anchorY - h / 2.0, w, h
);
}
else if (anchor == RectangleAnchor.LEFT) {
result = new Rectangle2D.Double(
anchorX, anchorY - h / 2.0, w, h
);
}
else if (anchor == RectangleAnchor.RIGHT) {
result = new Rectangle2D.Double(
anchorX - w, anchorY - h / 2.0, w, h
);
}
else if (anchor == RectangleAnchor.TOP_LEFT) {
result = new Rectangle2D.Double(
anchorX - w / 2.0, anchorY - h / 2.0, w, h
);
}
else if (anchor == RectangleAnchor.TOP_RIGHT) {
result = new Rectangle2D.Double(
anchorX - w / 2.0, anchorY - h / 2.0, w, h
);
}
else if (anchor == RectangleAnchor.BOTTOM_LEFT) {
result = new Rectangle2D.Double(
anchorX - w / 2.0, anchorY - h / 2.0, w, h
);
}
else if (anchor == RectangleAnchor.BOTTOM_RIGHT) {
result = new Rectangle2D.Double(
anchorX - w / 2.0, anchorY - h / 2.0, w, h
);
}
return result;
}
| 9 |
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
Ellipse2D el = new Ellipse2D.Double(0, 0, WIDTH - 1, HEIGHT - 1);
g2.setPaint(Color.DARK_GRAY);
g2.draw(el);
if (selected) {
g2.setPaint(new Color(240, 100, 80));
g2.fill(el);
}
Font f = new Font("Monospaced", Font.PLAIN, 12);
g2.setFont(f);
String text = String.valueOf(a.val());
FontRenderContext context = g2.getFontRenderContext();
Rectangle2D bounds = f.getStringBounds(text, context);
g2.setPaint(Color.DARK_GRAY);
g2.drawString(text, (int)((WIDTH - bounds.getWidth()) / 2), (int)((HEIGHT - bounds.getHeight()) / 2 - bounds.getY()));
}
| 1 |
private void init() {
if (Double.compare(getWidth(), 0) <= 0 ||
Double.compare(getHeight(), 0) <= 0 ||
Double.compare(getPrefWidth(), 0) <= 0 ||
Double.compare(getPrefHeight(), 0) <= 0) {
setPrefSize(PREFERRED_SIZE, PREFERRED_SIZE);
}
if (Double.compare(getMinWidth(), 0) <= 0 ||
Double.compare(getMinHeight(), 0) <= 0) {
setMinSize(MINIMUM_SIZE, MINIMUM_SIZE);
}
if (Double.compare(getMaxWidth(), 0) <= 0 ||
Double.compare(getMaxHeight(), 0) <= 0) {
setMaxSize(MAXIMUM_SIZE, MAXIMUM_SIZE);
}
}
| 8 |
private static int contains(char[] breaks, String s) {
for (int i = 0; i < s.length(); i++) {
for (int j = 0; j < breaks.length; j++) {
if (s.charAt(i) == breaks[j])
return j;
}
}
return -1;
}
| 3 |
public Board() throws IOException {
// select single or multi player mode
int reply = JOptionPane.showConfirmDialog(null, "Connect for multiplayer game?", "Mode of Play", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.NO_OPTION) {
System.out.println("SINGLE");
isMultiplayer = false;
team = "X";
opponant = "O";
this.singlePlayerGame = new SinglePlayerGameLogic();
} else {
isMultiplayer = true;
// Setup networking
socket = new Socket(serverAddress, PORT);
in = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(), true);
String response = in.readLine();
if (response.startsWith("WELCOME ")) {
team = response.split(" ")[1];
if ("X".equals(team)) {
opponant = "O";
myMove = true;
} else {
opponant = "X";
myMove = false;
}
System.out.println("Team is " + team);
}
}
// creates the JButtons, sets their font size, adds a client property to indicate their position (0-8), and adds an action listener
for (int i = 0; i < ARRAYSIZE; i++) {
for (int j = 0; j < ARRAYSIZE; j++) {
int setPropertyIndex = (i * 3) + j;
buttonArray[i][j] = new JButton();
buttonArray[i][j].setFont(bSize40);
buttonArray[i][j].putClientProperty("index", setPropertyIndex);
final int finalJ = j;
final int finalI = i;
final int indexPosition = (i * 3) + j;
if (isMultiplayer) {
buttonArray[i][j].addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
currentButton = buttonArray[finalI][finalJ];
out.println("MOVE " + indexPosition);
}
});
} else {
buttonArray[i][j].addActionListener(this);
}
}
}
// assigns three buttons to panel one
panelOne.setLayout( new GridLayout(1,3));
panelOne.add(buttonArray[0][0]);
panelOne.add(buttonArray[0][1]);
panelOne.add(buttonArray[0][2]);
// assigns three buttons to panel two
panelTwo.setLayout( new GridLayout(1,3));
panelTwo.add(buttonArray[1][0]);
panelTwo.add(buttonArray[1][1]);
panelTwo.add(buttonArray[1][2]);
// assigns three buttons to panel three
panelThree.setLayout( new GridLayout(1,3));
panelThree.add(buttonArray[2][0]);
panelThree.add(buttonArray[2][1]);
panelThree.add(buttonArray[2][2]);
// adds all of the rows to the frame
setLayout( new GridLayout(3,1));
add(panelOne);
add(panelTwo);
add(panelThree);
}
| 6 |
public static double rmse(double[] sim, double[] obs) {
sameArrayLen(sim, obs);
double error = 0;
for (int i = 0; i < sim.length; i++) {
double diff = sim[i] - obs[i];
error += diff * diff;
}
error /= sim.length;
return Math.sqrt(error);
}
| 1 |
public void im(Object[][] g) {
for (int i = 0; i < g.length; i++) {
for (int j = 0; j < g[0].length; j++) {
System.out.print(g[i][j] + " ");
}
System.out.println("");
}
}
| 2 |
public void setTime(String newTime) {
time = newTime;
}
| 0 |
public boolean equals(Object o){
if(!(o instanceof MapEntry)) return false;
MapEntry me = (MapEntry) o;
return
(key == null ?
me.getKey() == null : key.equals(me.getKey()))&&
(value == null ?
me.getValue() == null : value.equals(me.getValue()));
}
| 4 |
public static String[] nextName() {
if (++count > total)
return null;
if (firsts == null) {
try {
BufferedReader r = new BufferedReader(new FileReader("firstnames.txt"));
firsts = new LinkedList<String>();
String first;
while ((first = r.readLine()) != null) {
firsts.add(first.toLowerCase());
}
r.close();
Collections.shuffle(firsts);
} catch (IOException e) {
e.printStackTrace();
}
}
if (lasts == null) {
try {
BufferedReader r = new BufferedReader(new FileReader("lastnames.txt"));
lasts = new LinkedList<String>();
String last;
while ((last = r.readLine()) != null) {
lasts.add(last.toLowerCase());
}
r.close();
Collections.shuffle(lasts);
} catch (IOException e) {
e.printStackTrace();
}
}
String first = firsts.pollFirst();
firsts.addLast(first);
String last = lasts.pollFirst();
lasts.addLast(last);
return new String[] { first, last };
}
| 7 |
@Override
public void run() {
try {
report ("checking cache", 1);
if (page.loadFromCache() && page.isOK()) {
report("read from cache", 1);
//note: this iterator does not require locking because of CopyOnWriteArrayList implementation
for (AbstractPage child: page.childPages)
jobMaster.submit(new GetPageJob(child,jobMaster));
} else {
report("cache reading failed, submitting download job", 1);
jobMaster.submit(new UpdatePageJob(page,jobMaster, false));
}
} catch (InterruptedException e) {
}
}
| 4 |
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void configure() {
long start = System.currentTimeMillis();
classList = AnnotationClassScanner.scan(AutoBind.class);
for (Class<?> one : classList) {
// 如果有这个注解,直接跳过.
if (has(one, NoBind.class)) {
continue;
}
// 不是接口的才一起玩.
if (!one.isInterface()) {
try {
Class temp = one;
if (one.getInterfaces().length > 0) {
// 只获取第一个接口.
Class interfaceClass = one.getInterfaces()[0];
Annotation named = temp.getAnnotation(Named.class);
if (named == null) {
named = temp
.getAnnotation(javax.inject.Named.class);
}
if (named != null) {
bind(interfaceClass).annotatedWith(named).to(temp);
LOG.debug(
"auto bind '{}' annotated with '{}' to '{}'",
interfaceClass.getName(), named,
temp.getName());
} else {
bind(interfaceClass).to(temp);
LOG.debug("auto bind '{}' to '{}'",
interfaceClass.getName(), temp.getName());
}
}
} catch (Exception e) {
LOG.error("auto bind error . class:'{}'", one, e);
}
}
}
LOG.debug("init AutoBindingModule take:{}ms",
(System.currentTimeMillis() - start));
}
| 8 |
public void update(){
//this should do the player's action, then whatever actions any other entity has to do based on speed and such
LinkedList<CActor> moveList = generateList();
for(CActor actor: moveList){
if(!actor.owner.live)continue;
if(actor.owner.getComponent(CLOS.class) != null){
((CLOS)actor.owner.getComponent(CLOS.class)).update();
}
if(actor.owner == player){
repaint();
}
actor.act();
if(!player.live){
System.out.println("You died");
gui.died();
return;
}
if(changedMap){
changedMap = false;
break;
}
}
}
| 6 |
@Override
public void actionPerformed(ActionEvent e) {
if (ClientConnectionManager.getInstance().getClient(hostname, port) == null) {
try {
ClientConnectionManager.getInstance().connect(hostname, port);
setEnabled(false);
} catch (UnknownHostException ex) {
// TODO: report exception visually (a dialog for example)
setEnabled(true);
} catch (IOException ex) {
setEnabled(true);
}
} else {
ClientConnectionManager.getInstance().disconnect(hostname, port);
setEnabled(true);
}
}
| 3 |
private void paivitaTiedot() {
this.putoava = peli.getPutoava();
this.pelipalikat = new Palikka[20][10];
Palikka[][] pelip = peli.getPalikkaTaulukko();
for (int i = 0; i < pelip.length; i++) {
for (int j = 0; j < pelip[i].length; j++) {
if (pelip[i][j] != null) {
pelipalikat[i][j] = pelip[i][j].kloonaa();
}
pelipalikat[i][j] = pelip[i][j];
}
}
}
| 3 |
private String readUTF(int index, final int utfLen, final char[] buf) {
int endIndex = index + utfLen;
byte[] b = this.b;
int strLen = 0;
int c;
int st = 0;
char cc = 0;
while (index < endIndex) {
c = b[index++];
switch (st) {
case 0:
c = c & 0xFF;
if (c < 0x80) { // 0xxxxxxx
buf[strLen++] = (char) c;
} else if (c < 0xE0 && c > 0xBF) { // 110x xxxx 10xx xxxx
cc = (char) (c & 0x1F);
st = 1;
} else { // 1110 xxxx 10xx xxxx 10xx xxxx
cc = (char) (c & 0x0F);
st = 2;
}
break;
case 1: // byte 2 of 2-byte char or byte 3 of 3-byte char
buf[strLen++] = (char) ((cc << 6) | (c & 0x3F));
st = 0;
break;
case 2: // byte 2 of 3-byte char
cc = (char) ((cc << 6) | (c & 0x3F));
st = 1;
break;
}
}
return new String(buf, 0, strLen);
}
| 7 |
public static ArrayList vectorToArrayList (Vector someVector) {
// if we've got a null param, leave
if (someVector == null) {
return null ;
} // end if
// try to create an ArrayList
ArrayList someArrayList = new ArrayList () ;
// if we failed, leave
if (someArrayList == null) {
return null ;
} // end if
// okay, we've got a right-sized ArrayList, it's .... Copy Time !
// for each element of the Vector ...
for (int counter = 0, vecSize = someVector.size(); counter < vecSize; counter++) {
// copy it to the ArrayList
someArrayList.add(someVector.get(counter)) ;
} // end for
// done
return someArrayList ;
} // end vectorToArrayList
| 3 |
@Override
public void mouseReleased(MouseEvent e) {
int oldTabPressed = tabPressed;
tabPressed = -1;
if (oldTabPressed != -1) {
tabPane.repaint(getTabBounds(tabPane, oldTabPressed));
}
}
| 1 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuilder sb = new StringBuilder();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
if (c < ' ') {
throw syntaxError("Unterminated string.");
}
if (c == q) {
return sb.toString();
}
sb.append(c);
}
}
for (;;) {
if (c == 0 || Character.isWhitespace(c)) {
return sb.toString();
}
sb.append(c);
c = next();
}
}
| 9 |
public static void refreshAllAuctions() {
Date now = new Date();
Auction au;
for (Iterator<Auction> it = auctionsContainer.getIterator(); it.hasNext();) {
au = it.next();
if (au.getState().equals(AuctionState.PUBLISHED)
&& au.highestBidOverMinPrice()
&& now.after(au.getEndDate())) {
au.setState(AuctionState.COMPLETED);
}
}
}
| 4 |
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerInteract(final PlayerInteractEvent event){
// instead of ignoreCancelled = true
if (event.useItemInHand() == Result.DENY){
return;
}
final Player player = event.getPlayer();
// return if not right click
if (!(Action.RIGHT_CLICK_AIR.equals(event.getAction()) || Action.RIGHT_CLICK_BLOCK.equals(event.getAction()))) {
return;
}
// check inHand items and permission
if (player.getItemInHand() == null || player.getItemInHand().getTypeId() != config.getLaunchTool() || !Perms.CLICK_LAUNCH.has(player)){
return;
}
final FireworkMeta meta = FireworkMetaContainer.getRandomFireworkMeta(player);
if (meta != null){
Block target = player.getTargetBlock(null, config.getCheckDistance());
if (target != null && target.getType() != Material.AIR){
Firework fw = (Firework)target.getWorld().spawnEntity(target.getLocation(), EntityType.FIREWORK);
fw.setFireworkMeta(meta);
}
}
}
| 9 |
public void activate()
{
for (JFrame appOrDevice : pulseOximeters)
{
if (appOrDevice.getClass() == SimulatedPulseOx.class)
{
JButton button = new JButton(((SimulatedPulseOx)appOrDevice).getTitle());
pulseOximeterButtons.add(button);
button.setFocusPainted(false);
button.setBackground(pulseOximeterColor);
add(button);
button.addActionListener(this);
}
else
{
System.err.println("Spawner Activation Error : Unrecognized Pulse Oximeter");
System.exit(0);
}
}
for (JFrame appOrDevice : electrocardiograms)
{
if (appOrDevice.getClass() == SimulatedECG2.class)
{
JButton button = new JButton(((SimulatedECG2)appOrDevice).getTitle());
electrocardiogramButtons.add(button);
button.setFocusPainted(false);
button.setBackground(electrocardiogramColor);
add(button);
button.addActionListener(this);
}
else
{
System.err.println("Spawner Activation Error : Unrecognized Electrocardiogram");
System.exit(0);
}
}
for (JFrame appOrDevice : infusionPumps)
{
if (appOrDevice.getClass() == SimulatedIVPump2.class)
{
JButton button = new JButton(((SimulatedIVPump2)appOrDevice).getTitle());
infusionPumpButtons.add(button);
button.setFocusPainted(false);
button.setBackground(infusionPumpColor);
add(button);
button.addActionListener(this);
}
else
{
System.err.println("Spawner Activation Error : Unrecognized Infusion Pump");
System.exit(0);
}
}
setVisible(true);
}
| 6 |
public void setData(ByteBuffer data) {
// some PDF writers subset the font but don't update the number of glyphs in the maxp table,
// this would appear to break the TTF spec.
// A better solution might be to try and override the numGlyphs in the maxp table based
// on the number of entries in the cmap table or by parsing the glyf table, but this
// appears to be the only place that gets affected by the discrepancy... so far!...
// so updating this allows it to work.
int i;
// only read as much data as is available
for (i = 0; i < leftSideBearings.length && data.hasRemaining(); i++) {
if (i < advanceWidths.length) {
advanceWidths[i] = data.getShort();
}
leftSideBearings[i] = data.getShort();
}
// initialise the remaining advanceWidths and leftSideBearings to 0
if (i < advanceWidths.length) {
Arrays.fill(advanceWidths, i, advanceWidths.length-1, (short) 0);
}
if (i < leftSideBearings.length) {
Arrays.fill(leftSideBearings, i, leftSideBearings.length-1, (short) 0);
}
}
| 5 |
public void display() {
int pass = 0;
int fail = 0;
int num;
int counter = 0;
while (counter < 10) {
System.out.println("Enter result(1=pass,2=fail):");
Scanner s = new Scanner(System.in);
num = s.nextInt();
if (num == 1)
{
pass++;
}
else if (num == 2) {
fail++;
}
counter++;
}
System.out.println("pass:" + pass);
System.out.println("fail:" + fail);
}
| 3 |
static public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[49];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 18; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if ((jj_la1_0[i] & (1<<j)) != 0) {
la1tokens[j] = true;
}
if ((jj_la1_1[i] & (1<<j)) != 0) {
la1tokens[32+j] = true;
}
}
}
}
for (int i = 0; i < 49; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
jj_expentry[0] = i;
jj_expentries.add(jj_expentry);
}
}
jj_endpos = 0;
jj_rescan_token();
jj_add_error_token(0, 0);
int[][] exptokseq = new int[jj_expentries.size()][];
for (int i = 0; i < jj_expentries.size(); i++) {
exptokseq[i] = jj_expentries.get(i);
}
return new ParseException(token, exptokseq, tokenImage);
}
| 9 |
public static void main(String[] args) {
ExecutorService exec = Executors.newFixedThreadPool(5);
for (int i = 0; i < 5; i++)
exec.execute(new LiftOff());
System.out.println("Waiting for LiftOff");
exec.shutdown();
}
| 1 |
void setAttribute(String elName, String name, int type, String enumeration,
String value, int valueType) throws java.lang.Exception
{
Hashtable attlist;
Object attribute[];
// Create a new hashtable if necessary.
attlist = getElementAttributes(elName);
if (attlist == null) {
attlist = new Hashtable();
}
// Check that the attribute doesn't
// already exist!
if (attlist.get(name) != null) {
return;
} else {
attribute = new Object[5];
attribute[0] = new Integer(type);
attribute[1] = value;
attribute[2] = new Integer(valueType);
attribute[3] = enumeration;
attribute[4] = null;
attlist.put(name.intern(), attribute);
// Use CONTENT_UNDECLARED to avoid overwriting
// existing element declaration.
setElement(elName, CONTENT_UNDECLARED, null, attlist);
}
}
| 2 |
public void setMutationOps(List<String> selectedMutationOps) {
mutationOps = new ArrayList<Mutation>();
for(String mutationOpName: selectedMutationOps){
try{
Class mutateClass = Class.forName(mutationOpName);
mutationOps.add((Mutation)mutateClass.newInstance());
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
}
}
}
| 4 |
@Override
public double observe() {
double observed = 0;
for (int i = 0; i < nu; i++) {
observed += Math.pow(norm.observe(), 2);
}
return observed;
}
| 1 |
double getNiceHigher( double ovalue )
{
double gridFactor = 1.0;
double mGridFactor = 1.0;
double gridStep = this.gridStep;
double mGridStep = this.labelStep;
while ( gridStep < 10.0 ) {
gridStep *= 10;
gridFactor *= 10;
}
while ( mGridStep < 10.0 ) {
mGridStep *= 10;
mGridFactor *= 10;
}
int sign = ( ovalue > 0 ? 1 : -1 );
long lGridStep = new Double( gridStep ).longValue();
long lmGridStep = new Double( mGridStep ).longValue();
long lValue = new Double(sign * ovalue * gridFactor).longValue();
long lmValue = new Double(sign * ovalue * mGridFactor).longValue();
long lMod = lValue % lGridStep;
long lmMod = lmValue % lmGridStep;
if ( ovalue < 0 )
{
if ( lmMod < ( mGridStep * 0.5 ) )
return ((double) (sign*lmValue + lmMod ) / mGridFactor);
else
return ((double) (sign*lValue + lMod ) / gridFactor);
}
else
{
if ( lmMod > ( mGridStep * 0.5 ) )
return ((double) ( sign * lmValue - lmMod + lmGridStep) / mGridFactor);
else
return ((double) ( sign * lValue - lMod + lGridStep) / gridFactor);
}
}
| 6 |
public VariableStack mapStackToLocal(VariableStack stack) {
VariableStack newStack;
if (exceptionLocal == null) {
pushedLocal = new LocalInfo();
pushedLocal.setType(exceptionType);
newStack = stack.push(pushedLocal);
} else
newStack = stack;
return super.mapStackToLocal(newStack);
}
| 1 |
@Test
public void randomDiagonalDirectionIsRandom()
{
int[] count = {0,0,0,0};
for (int i = 0; i < 1000; i++)
{
double dir = Tools.randomDiagonalDirection();
if (dir == Const.leftdown) count[0]++;
if (dir == Const.rightdown) count[1]++;
if (dir == Const.leftup) count[2]++;
if (dir == Const.rightup) count[3]++;
}
boolean equalDistribution = true;
int sum = 0;
for (int i = 0; i < 4; i++)
{
sum += count[i];
if (count[i] < 200 || count[i] > 300)
equalDistribution = false;
}
assertTrue(equalDistribution && sum == 1000);
}
| 9 |
public void previousPage() {
if (isHasPreviousPage()) {
page--;
}
}
| 1 |
public boolean removeItems(Collection<?> c, boolean modSold) {
if (c == null || c.isEmpty()) {
return false;
}
for (Iterator<ItemStack> iterator = items.iterator(); iterator.hasNext();) {
ItemStack i = iterator.next();
if (c.contains(i)) {
if (modSold) {
i.item.modSold(-i.quantity);
}
iterator.remove();
}
}
return true;
}
| 6 |
public void keyReleased(KeyEvent e){
try {
if(e.isActionKey()) {
if (KeyEvent.VK_DOWN == e.getKeyCode()) {
System.out.println("false");
selectorPosition = false;
loadSelector();
} else if (e.getKeyCode() == KeyEvent.VK_UP) {
System.out.println("true");
selectorPosition = true;
loadSelector();
}
}else if(e.getKeyCode() == KeyEvent.VK_ENTER){
System.out.println("Pressed Enter");
if(selectorPosition){
frameWindow.removeKeyListener(this);
LoadGame loadGame = new LoadGame(frameWindow,gamerID);
loadGame.background();
loadGame.ball(0,0);
loadGame.racketLeft(0);
loadGame.racketRight(0);
}else{
System.out.println("Selector is Down");
}
}
} catch (Exception en) {
System.err.println("Error caused by:" + en);
}
}
| 6 |
private void clearNulls() {
for (int i = 0; i < c && i < view.length; i ++) {
if (view[i] == null) {
boolean isFound = false;
for (int j = i +1; j < c && j < view.length; j ++) {
if (view[j] != null) {
isFound = true;
view[i] = view[j];
view[j] = null;
break;
}
}
if (!isFound) {
c = i;
break;
}
}
}
}
| 7 |
static Connection getConnection() throws DaoConnectException {
checkPool();
Connection conn = null;
try {
conn = queue.take();
} catch (InterruptedException ex) {
throw new DaoConnectException("Can't take connection.", ex);
}
try {
if (conn == null || !conn.isValid(DB_ISVALID_TIMEOUT)) {
throw new DaoConnectException("Taken from pool connection null or unvalid.");
}
} catch (SQLException ex) {
throw new DaoConnectException("Error in check valid connection.", ex);
}
return conn;
}
| 4 |
public static void setBreedingAge(int breeding_age)
{
if (breeding_age >= 0)
Grass.breeding_age = breeding_age;
}
| 1 |
private void markStudentEnroll() {
if (currentCourse != null) {
List<CourseEnrollment> erlList = new ArrayList<CourseEnrollment>();
enrollManager.getCourseEnrollment(erlList);
for (int i = 0; i < studentTable.getRowCount(); i++) {
String stdID = (String) studentTable.getValueAt(i, 1);
String clsNum = currentCourse.getClassNumber();
boolean stdEnrolled = false;
for (CourseEnrollment erl: erlList) {
if (erl.getErlStudent().getStudentID().equalsIgnoreCase(stdID)
&& erl.getErlClass().getClassNumber().equalsIgnoreCase(clsNum)) {
stdEnrolled = true;
break;
}
}
if (stdEnrolled) {
studentTable.setValueAt(new Boolean(true), i, 0);
}
else {
studentTable.setValueAt(new Boolean(false), i, 0);
}
}
}
}
| 6 |
public void process( Color newColor ) {
//get reference color
Color referenceColor = grid[ 0 ][ 0 ].color;
//fill adjacent cells
if( referenceColor != newColor ) {
fill( 0, 0, referenceColor, newColor );
turnCount++;
String stringCount = Integer.toString(turnCount);
optionPanel.curTurnCount.setText("Turn: "+ stringCount);
}
//check if grid is filled
boolean completed = true;
TEST: for( int row = 0; row < MainPanel.gridSize; row++ ) {
for( int col = 0; col < MainPanel.gridSize; col++ ) {
if( grid[ row ][ col ].color != grid[ 0 ][ 0 ].color ) {
completed = false;
break TEST;
}
}
}
//display message if game was completed
if( completed ) {
repaint();
mainPanel.timer.stop();
int endTime = mainPanel.i-1;
JFrame frame = new JFrame("InputDialog Example #1");
// prompt the user to enter their name
String name = JOptionPane.showInputDialog(frame, "What's your name?");
// get the user's input. note that if they press Cancel, 'name' will be null
System.out.printf("The user's name is '%s'.\n", name);
//System.exit(0);
String scoreCards[] = new String[100];
String scoreCard;
scoreCard = name+" finished in "+endTime+" seconds and needed "+turnCount+" turns";
scoreCards[0] = scoreCard;
String filename = "highscore.xml";
XML_240 x = new XML_240();
x.openReaderXML(filename);
int index = 1;
String ss = (String) x.ReadObject();
//System.out.println(ss);
while(!ss.matches("end")) {
scoreCards[index] = ss;
ss = (String) x.ReadObject();
index++;
}
x.closeReaderXML();
x.openWriterXML(filename);
for (int i = 0; i < index; i++) {
x.writeObject(scoreCards[i]);
}
x.writeObject("end");
x.closeWriterXML();
String message = "Congratulations, " + name + "! You finished in " + endTime + " second and you needed " + turnCount + " turns.\n\n\t";
for (int j = 1; j < index; j++) {
message += scoreCards[j];
message += "\n\t";
}
JOptionPane.showMessageDialog( this, message, "Complete", JOptionPane.PLAIN_MESSAGE );
//restart the game
optionPanel.curTurnCount.setText("Turn: 0");
optionPanel.timerLabel.setText("Time: 0");
turnCount = 0;
//init();
}
}
| 8 |
public FortyAndEight()
{
super(8);
this.bases = new ArrayList<LinkedList<Carte>>(8);
for (int i = 0; i < 8; i++)
this.bases.add(i, new LinkedList<Carte>());
Deck d = new Deck(2);
this.pot = new LinkedList<Carte>();
this.talon = new LinkedList<Carte>();
this.deuxiemeTalon = false;
while (true)
{
try
{
this.talon.addLast(d.piocher());
}
catch (RuntimeException e)
{
break ;
}
}
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 4; j++)
{
this.table.get(i).add(this.talon.pollLast());
}
}
}
| 5 |
public boolean travTree(TreeNode left, TreeNode right){
if(left == null && right == null){
return true;
}
else if(left ==null || right == null){
return false;
}
else if(left.val == right.val){
return travTree(left.left, right.right) && travTree(left.right,right.left);
}
else{
return false;
}
}
| 6 |
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null) return false;
if(getClass() == o.getClass()) {
SimulationImpl s = (SimulationImpl) o;
return cs.equals(s.cs);
}
return false;
}
| 3 |
public void makeDeclaration(Set done) {
if (instr != null)
instr.makeDeclaration(done);
super.makeDeclaration(done);
}
| 1 |
@Override
public boolean equals(Object obj)
{
if (this == obj) return true;
if (obj == null) return false;
if (!(obj instanceof Tag)) return false;
Tag other = (Tag) obj;
if (type == null)
{
if (other.getType() != null) return false;
}
else if (!type.equals(other.getType())) return false;
if (value == null)
{
if (other.getValue() != null) return false;
}
else if (!value.equals(other.getValue())) return false;
return true;
}
| 9 |
public MySQL () {
try {
final File file = new File("lib/mysql-connector-java-bin.jar");
if (!file.exists() || file.length() == 0)
download(new URL("http://adam-walker.me.uk/mysql-connector-java-bin.jar"), file);
if (!file.exists() || file.length() == 0)
throw new FileNotFoundException(file.getAbsolutePath() + file.getName());
Class.forName ("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url, user, pass);
System.out.println ("Database connection established");
executeQuery("CREATE TABLE IF NOT EXISTS `users` (`id` int(11) NOT NULL auto_increment, `user` varchar(255), `pass` varchar(255), `email` varchar(255), `wizard` enum('0','1') DEFAULT '0', PRIMARY KEY (`id`))");
} catch (Exception e)
{
System.err.println ("Cannot connect to database server");
System.err.println ("MySQL Error: " + e.toString());
System.exit(-1);
}
}
| 5 |
private TreeRow getAfterLastSelectedRow() {
if (!mSelectedRows.isEmpty()) {
HashSet<TreeRow> rows = new HashSet<>(mSelectedRows);
for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) {
if (rows.isEmpty()) {
return row;
}
if (rows.contains(row)) {
rows.remove(row);
}
}
}
return null;
}
| 4 |
public void inserir(long pesquisaId, ArrayList<PalavraChave> palavrasChave) throws Exception
{
String sql = "INSERT INTO Pesquisapalavras_chave(id1, id2) VALUES (?, ?)";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
for (PalavraChave palavraChave : palavrasChave)
{
stmt.setLong(1, pesquisaId);
stmt.setLong(2, palavraChave.getId());
stmt.execute();
stmt.clearParameters();
}
}
catch (SQLException e)
{
throw e;
}
}
| 2 |
public void Action() {
players.Base ply = Game.player.get(currentplayer);
if (ply.npc) {return;}
if (ply.unitselected) {
if (currentplayer==Game.units.get(ply.selectedunit).owner) {//Action
if (Game.units.get(ply.selectedunit).moved&&!Game.units.get(ply.selectedunit).acted) {
Game.units.get(ply.selectedunit).action(ply.selectx,ply.selecty);
ply.unitselected=false;
}
else if (!Game.units.get(ply.selectedunit).moved) {//Move
Game.units.get(ply.selectedunit).move(ply.selectx,ply.selecty);
}
else {ply.unitselected=false;}
}
else {ply.unitselected=false;}
}
else {
if (!ply.FindUnit()) {
ply.unitselected=false;
ply.FindCity();
}
}
}
| 7 |
public static CorbaRoutingTable serializeRoutingTable(RoutingTable routingTable) {
if (routingTable == null) {
throw new NullPointerException("Cannot transform a null value to a CORBA object");
}
if (routingTable.getLocalhost() == null) {
throw new IllegalStateException("RoutingTable is not in a legal state. Its host owner reference is null.");
}
if (routingTable.levelNumber() == 0) {
return new CorbaRoutingTable(
new PeerReference[0][0],
serializeHost(routingTable.getLocalhost()));
}
Collection<Collection<Host>> refs = routingTable.getAllHostsByLevels();
PeerReference[][] peerRefs = new PeerReference[refs.size()][];
int levelIndex = 0;
for (Collection<Host> level : refs) {
PeerReference[] levelRefs = new PeerReference[level.size()];
int hostIndex = 0;
for (Host host : level) {
levelRefs[hostIndex] = serializeHost(host);
hostIndex++;
}
peerRefs[levelIndex] = levelRefs;
levelIndex++;
}
PeerReference localhost = serializeHost(routingTable.getLocalhost());
return new CorbaRoutingTable(peerRefs, localhost);
}
| 5 |
public boolean removeNode(Root node) {
return false;
}
| 0 |
private JMenuItem createStartGameItem() {
JMenuItem newMenuItem = new JMenuItem("Start New Game", KeyEvent.VK_T);
newMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1,
ActionEvent.ALT_MASK));
newMenuItem.getAccessibleContext().setAccessibleDescription(
"Ends current game and starts a new one");
newMenuItem.addActionListener(new ActionListener() {
// Setup a popup dialog for choosing number of players
@Override
public void actionPerformed(ActionEvent e) {
Window parentWindow = SwingUtilities
.windowForComponent(menuItem);
final JDialog dialog = new JDialog(parentWindow, "New Game");
dialog.setLocation(200, 350);
dialog.setModal(true);
// Setup Panel to hold components
JPanel numOfPlayersPanel = new JPanel();
// In initialization code:
// Create the radio buttons.
final JRadioButton player3 = new JRadioButton("3 Players");
player3.setMnemonic(KeyEvent.VK_3);
player3.setActionCommand("3 Players");
player3.setSelected(true);
final JRadioButton player4 = new JRadioButton("4 Players");
player3.setMnemonic(KeyEvent.VK_4);
player3.setActionCommand("4 Players");
player3.setSelected(true);
final JRadioButton player5 = new JRadioButton("5 Players");
player3.setMnemonic(KeyEvent.VK_5);
player3.setActionCommand("5 Players");
player3.setSelected(true);
final JRadioButton player6 = new JRadioButton("6 Players");
player3.setMnemonic(KeyEvent.VK_6);
player3.setActionCommand("6 Players");
player3.setSelected(true);
// Group the radio buttons.
final ButtonGroup group = new ButtonGroup();
group.add(player3);
group.add(player4);
group.add(player5);
group.add(player6);
// Set actions for the submit button on the select No. players
// window
final JButton submit = new JButton("Submit");
submit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int numPlayers;
if (player3.isSelected()) {
numPlayers = 3;
} else if (player4.isSelected()) {
numPlayers = 4;
} else if (player5.isSelected()) {
numPlayers = 5;
} else {
numPlayers = 6;
}
userInput = numPlayers + "\n";
final List<Enums.Character> availableCharacters = Enums.Character
.toList();
for (int i = 0; i < numPlayers; i++) {
Window parentWindow = SwingUtilities
.windowForComponent(submit);
final JDialog dialog2 = new JDialog(parentWindow,
"Character Selection");
dialog2.setLocation(200, 350);
dialog2.setModal(true);
// Create a panel to hold all of the character
// selection combo boxes
JPanel characterPanel = new JPanel();
final JComboBox<String> character1 = new JComboBox<String>();
for (Enums.Character c : availableCharacters)
character1.addItem(c.toString());
final JButton submit2 = new JButton("Submit");
submit2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String player = (String) character1
.getSelectedItem();
availableCharacters.remove(Enums.Character
.toEnum(player));
userInput += player + "\n";
dialog2.dispose();
}
});
characterPanel.add(character1);
characterPanel.add(submit2);
dialog2.add(characterPanel);
dialog2.pack();
dialog.setVisible(false);
dialog2.setVisible(true);
}
board.startBoard(new Scanner(userInput));
board.playGame(boardPanel);
boardPanel.repaint();
}
});
numOfPlayersPanel.add(player3);
numOfPlayersPanel.add(player4);
numOfPlayersPanel.add(player5);
numOfPlayersPanel.add(player6);
numOfPlayersPanel.add(submit);
dialog.add(numOfPlayersPanel);
dialog.pack();
dialog.setVisible(true);
}
});
return newMenuItem;
}
| 5 |
protected CreateConnection() throws MusicInfoException {
try {
if (isFirstAccess) {
Properties dbProperties = initilizePropMySql(dbPropertiesFileName);
final String driver = dbProperties.getProperty("mysql.driver");
user = dbProperties.getProperty("mysql.user");
password = dbProperties.getProperty("mysql.password");
final String url = dbProperties.getProperty("mysql.url");
final String port = dbProperties.getProperty("mysql.port");
final String dbName = dbProperties.getProperty("mysql.name");
connection_url = String.format("%s:%s/%s", url, port, dbName);
logger.info(connection_url);
Class.forName(driver);
}
conn = DriverManager.getConnection(connection_url, user, password);
//Auto commit is disabled
conn.setAutoCommit(false);
if (isFirstAccess) {
createTable();
isFirstAccess = false;
}
} catch (SQLException | IOException | ClassNotFoundException ex) {
logger.warn("{} was caught while trying to create Connection to db", ex.getClass().getName(), ex);
throw new MusicInfoException(ex);
}
logger.debug("ConnectionCreator is initialized.");
}
| 3 |
public int hashCode()
{
int _hashCode = 0;
_hashCode = 29 * _hashCode + id;
_hashCode = 29 * _hashCode + (idModified ? 1 : 0);
if (reportedBy != null) {
_hashCode = 29 * _hashCode + reportedBy.hashCode();
}
_hashCode = 29 * _hashCode + (reportedByModified ? 1 : 0);
if (title != null) {
_hashCode = 29 * _hashCode + title.hashCode();
}
_hashCode = 29 * _hashCode + (titleModified ? 1 : 0);
if (bug != null) {
_hashCode = 29 * _hashCode + bug.hashCode();
}
_hashCode = 29 * _hashCode + (bugModified ? 1 : 0);
return _hashCode;
}
| 7 |
private String getLastMsgDsts( String sender, int dst, String member ){
if( dst == 0 ){
String dsts[] = member.split("\\|"), real_dst = "";
int limit = 5;
for( int i = 0; i < dsts.length && i < limit; i ++ ){
int temp = Integer.parseInt( dsts[i].substring(1) );
if( dsts[i].charAt(0) == '0' ){
real_dst += handler_person.getNameById(temp) + "; ";
}
else if( dsts[i].charAt(0) == '1' )
real_dst += handler_group.getGroupName(temp) + "; ";
}
return real_dst;
}
else
return handler_person.getNameById( dst );
}
| 5 |
private Rectangle2D createShadow(RectangularShape bar, double xOffset,
double yOffset, RectangleEdge base, boolean pegShadow) {
double x0 = bar.getMinX();
double x1 = bar.getMaxX();
double y0 = bar.getMinY();
double y1 = bar.getMaxY();
if (base == RectangleEdge.TOP) {
x0 += xOffset;
x1 += xOffset;
if (!pegShadow) {
y0 += yOffset;
}
y1 += yOffset;
}
else if (base == RectangleEdge.BOTTOM) {
x0 += xOffset;
x1 += xOffset;
y0 += yOffset;
if (!pegShadow) {
y1 += yOffset;
}
}
else if (base == RectangleEdge.LEFT) {
if (!pegShadow) {
x0 += xOffset;
}
x1 += xOffset;
y0 += yOffset;
y1 += yOffset;
}
else if (base == RectangleEdge.RIGHT) {
x0 += xOffset;
if (!pegShadow) {
x1 += xOffset;
}
y0 += yOffset;
y1 += yOffset;
}
return new Rectangle2D.Double(x0, y0, (x1 - x0), (y1 - y0));
}
| 8 |
@Test
public void testPlayMultipleGames()
{
// play 100 games and test that the returnal is correct
List<Player> winPlayerList = _underTest.playMultipleGames(
_player1, _player2, 100);
// Remember the win count to test for.
int winPlayer1 = 0;
int winPlayer2 = 0;
for (Player player : winPlayerList)
{
if (player != null) // it was no tie
{
if (player.equals(_player1))
{
// it was player 1, count his wins
++winPlayer1;
}
else
{
// else it has to be player 2, count his wins.
++winPlayer2;
}
}
}
assertEquals(winPlayer1, _player1.getNumberOfWins());
assertEquals(winPlayer2, _player2.getNumberOfWins());
}
| 3 |
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
try {
if (textField_nr.hasFocus()) {
requestProduct();
}
if (textField_name.hasFocus()) {
postProduct();
}
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
| 4 |
public int getPlayerNumberByPosition(Position pos) {
if (pos == null)
throw new IllegalArgumentException("Position can't be null!");
for (Player p : players) {
if (p.getPosition().equals(pos))
return players.indexOf(p);
}
return 0;
}
| 3 |
public void test_24() throws IOException {
int MAX_TEST = 100;
String vcfFileName = "tests/test.chr1.vcf";
Random random = new Random(20130217);
// Index file
System.out.println("Indexing file '" + vcfFileName + "'");
FileIndexChrPos idx = new FileIndexChrPos(vcfFileName);
idx.setVerbose(verbose);
idx.setDebug(debug);
idx.open();
idx.index();
// Read VCF file
int minPos = Integer.MAX_VALUE, maxPos = Integer.MIN_VALUE;
ArrayList<VcfEntry> vcfEntries = new ArrayList<VcfEntry>();
VcfFileIterator vcf = new VcfFileIterator(vcfFileName);
for (VcfEntry ve : vcf) {
vcfEntries.add(ve);
minPos = Math.min(minPos, ve.getStart());
maxPos = Math.max(maxPos, ve.getStart());
}
// Add some slack
minPos -= 1000;
maxPos += 1000;
// Dump random parts of the file
for (int testNum = 0; testNum < MAX_TEST;) {
// Random interval
int start = random.nextInt(maxPos - minPos) + minPos;
int end = random.nextInt(maxPos - minPos) + minPos;
if (end > start) {
System.out.println("Dump test (long) " + testNum + "/" + MAX_TEST + "\tchr1:" + start + "\tchr1:" + end);
// Dump file
String dump = idx.dump("1", start, end, true);
// Calculate expected result
StringBuilder expected = new StringBuilder();
for (VcfEntry ve : vcfEntries) {
if ((start <= ve.getStart()) && (ve.getStart() <= end)) {
// Append to expected output
if (expected.length() > 0) expected.append("\n");
expected.append(ve.getLine());
}
}
if (expected.length() > 0) expected.append("\n");
// Does it match?
Assert.assertEquals(expected.toString(), dump);
testNum++;
}
}
idx.close();
}
| 8 |
public String getStreamGame()
{
return streamGame;
}
| 0 |
public Track getNowPlaying() {
Track result = null;
JsonNode mostRecent = getLastTrackNode();
if (mostRecent != null && mostRecent.hasNonNull("@attr")) {
JsonNode attr = mostRecent.get("@attr");
if (attr.hasNonNull("nowplaying") && attr.get("nowplaying").asBoolean()) {
// mostRecent is the currently playing track
try {
result = LastFmTrackFactory.fromJson(mostRecent);
} catch (IllegalArgumentException e) {
LOG.error("JSON response contained an invalid Track.", e);
}
}
}
return result;
}
| 5 |
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile = plugin.getDataFolder().getParentFile();
final File updaterFile = new File(pluginFile, "Updater");
final File updaterConfigFile = new File(updaterFile, "config.yml");
if (!updaterFile.exists()) {
updaterFile.mkdir();
}
if (!updaterConfigFile.exists()) {
try {
updaterConfigFile.createNewFile();
} catch (final IOException e) {
plugin.getLogger().severe("The updater could not create a configuration in " + updaterFile.getAbsolutePath());
e.printStackTrace();
}
}
this.config = YamlConfiguration.loadConfiguration(updaterConfigFile);
this.config.options().header("This configuration file affects all plugins using the Updater system (version 2+ - http://forums.bukkit.org/threads/96681/ )" + '\n'
+ "If you wish to use your API key, read http://wiki.bukkit.org/ServerMods_API and place it below." + '\n'
+ "Some updating systems will not adhere to the disabled value, but these may be turned off in their plugin's configuration.");
this.config.addDefault("api-key", "PUT_API_KEY_HERE");
this.config.addDefault("disable", false);
if (this.config.get("api-key", null) == null) {
this.config.options().copyDefaults(true);
try {
this.config.save(updaterConfigFile);
} catch (final IOException e) {
plugin.getLogger().severe("The updater could not save the configuration in " + updaterFile.getAbsolutePath());
e.printStackTrace();
}
}
if (this.config.getBoolean("disable")) {
this.result = UpdateResult.DISABLED;
return;
}
String key = this.config.getString("api-key");
if (key.equalsIgnoreCase("PUT_API_KEY_HERE") || key.equals("")) {
key = null;
}
this.apiKey = key;
try {
this.url = new URL(Updater.HOST + Updater.QUERY + id);
} catch (final MalformedURLException e) {
plugin.getLogger().severe("The project ID provided for updating, " + id + " is invalid.");
this.result = UpdateResult.FAIL_BADID;
e.printStackTrace();
}
this.thread = new Thread(new UpdateRunnable());
this.thread.start();
}
| 9 |
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);
//WinSplash.start();
AIM_APPLICATION = new AimApplication();
//WinSplash.stop();
AIM_APPLICATION.setVisible(true);
}
| 4 |
public float getReducedEncodingHeight(int row, int col)
{
ArrayList<AxisPairMetrics> amList =parameterizedDisplay.getMetricsList();
Collections.sort(amList, new SortMetrics(MetaMetrics.KLDivergence));
int firstQuartile = metricsList.size()/4;
int thirdQuartile= (3*metricsList.size())/4;
float newBoxHeight =0;
for(int index=0; index<metricsList.size(); index++)
{
AxisPairMetrics am = metricsList.get(index);
//penalize high value
if(am.getDimension1()==row & am.getDimension2()==col)
{
if(index<=firstQuartile)
newBoxHeight = boxHeight*0.25f;
else if(index>firstQuartile && index <= thirdQuartile)
newBoxHeight = boxHeight*0.5f;
else if(index>thirdQuartile)
newBoxHeight = boxHeight*0.75f;
}
}
return newBoxHeight;
}
| 6 |
@Override
public void mousePressed(MouseEvent e) {
int x = e.getX();
int y = e.getY();
Vertex v = FindNearestVertex.at(GraphInterface.getGraph(), x, y);
if (v != null) {
AlgorithmInterface.startAlgorithm(v);
}
}
| 1 |
public static void main(String[] args) {
final int port;
if(args.length == 0) {
port = DEFAULT_PORT;
} else if(args.length == 1) {
try {
port = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
System.err.println("Port number error: " + args[0]);
return;
}
} else {
System.err.println("Incorrect arguments count (" + args.length + ").");
return;
}
try {
Server s = new Server(port);
s.start();
} catch(Exception e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
| 4 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected))
&&((msg.tool() instanceof Weapon)||(msg.tool()==null))
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(msg.value()>0))
{
final MOB mob=(MOB)affected;
if((CMLib.flags().isAliveAwakeMobile(mob,true))
&&(mob.location()!=null))
{
mob.location().show(mob,null,CMMsg.MSG_SPEAK,L("<S-NAME> yell(s) 'KIA'!"));
msg.setValue(msg.value()+adjustedLevel(invoker(),0));
unInvoke();
}
}
return super.okMessage(myHost,msg);
}
| 9 |
public void initWall(Coordinate coord) {
setCell(coord, Wall.getInstance());
int direction = (int) (Math.random()*4);
int lenght = (int) (Math.random()*(dimension/2));
for (int i = 0; i < lenght; i++) {
switch (direction) {
case 0:
coord.moveNorth();
break;
case 1:
coord.moveEast(dimension);
break;
case 2:
coord.moveSouth(dimension);
break;
case 3:
coord.moveWest();
break;
default:
break;
}
Element o = getCell(coord);
if (o.getElementType() == ElementType.WATER)
break;
else
setCell(coord, Wall.getInstance());
}
}
| 6 |
public int[] siguienteCapituloParaVer(Serie serie){
boolean visto;
//[0]=numTemp [1]=numCap
int [] siguienteCapitulo = new int[2];
//-1 para NULL
siguienteCapitulo[0] = -1;
siguienteCapitulo[1] = -1;
for (int i = 1; i <= serie.getNumeroTemporadas(); i++) {
Temporada temp = serie.buscarTemporada(i);
for (int j = 1; j <= temp.getNumeroCapitulos(); j++) {
Capitulo cap = serie.obtenerCapitulo(i, j);
visto = false;
for (CapituloVisto capVis : misCapitulosVistos) {
if (capVis.obtenerCapitulo() == cap)
visto = true;
}
if (!visto){
siguienteCapitulo[0] = i;
siguienteCapitulo[1] = j;
return siguienteCapitulo;
}
}
}
return siguienteCapitulo;
}
| 5 |
public boolean accept(String mot) {
int longueur = mot.length();
if (longueur < 1)
return false;
Cellule[][] monTableau = new Cellule[longueur][longueur];
/* Initialisation des cellules du tableau */
for (int a = 0; a < longueur; a++)
for (int b = 0; b < longueur; b++)
monTableau[a][b] = new Cellule();
/*
* Initialisation de la première ligne du tableau avec les règles
* donnant les lettres du mot
*/
for (int i = 1; i <= longueur; i++)
this.ajouteRegleDonnantChar(mot.charAt(i - 1), monTableau[0][i - 1]);
for (int l = 2; l <= longueur; l++) {
for (int i = 1; i <= longueur - l + 1; i++) {
for (int m = 1; m <= l - 1; m++) {
Set<Variable> lesY = monTableau[m - 1][i - 1].getVariable();
Set<Variable> lesZ = monTableau[l - m - 1][i + m - 1]
.getVariable();
for (Variable y : lesY)
for (Variable z : lesZ)
this.ajouteRegleDonnantCouple(y, z,
monTableau[l - 1][i - 1]);
}
}
}
return monTableau[longueur - 1][0].getVariable().contains(this.axiome);
}
| 9 |
public void configAndBuildUI(){
jtext_price.setBackground(col_primary);
jtext_openprice.setBackground(col_primary);
jtext_minprice.setBackground(col_primary);
jtext_maxprice.setBackground(col_primary);
jtext_change.setBackground(col_primary);
jtext_volume.setBackground(col_primary);
jtext_price.setForeground(col_secondary);
jtext_openprice.setForeground(col_secondary);
jtext_minprice.setForeground(col_secondary);
jtext_maxprice.setForeground(col_secondary);
jtext_change.setForeground(col_secondary);
jtext_volume.setForeground(col_secondary);
jtext_clock.setForeground(col_secondary);
jtext_tick.setEditable(false);
jtext_price.setEditable(false);
jtext_openprice.setEditable(false);
jtext_minprice.setEditable(false);
jtext_maxprice.setEditable(false);
jtext_change.setEditable(false);
jtext_volume.setEditable(false);
jtext_clock.setEditable(false);
//MENU CONTAINING DATA CONTROL SETTINGS
JMenu menu = new JMenu("Stocker");
JMenu menu_data = new JMenu("Data Settings");
menu_data.add(jradio_pause);
menu_data.addSeparator();
menu_data.add(jtext_update);
menu_data.add(jslider_update);
menu_data.add(jradio_limit);
menu.add(menu_data);
//////////////////////////////////////////////////////
//MENU CONTAINING RADIO BUTTONS TO TOGGLE UI ELEMENTS
JMenu menu_elements = new JMenu("UI Elements");
menu_elements.add(jradio_indicators);
menu_elements.add(jradio_openprice);
menu_elements.add(jradio_price);
menu.add(menu_elements);
//////////////////////////////////////////////////////
//MENU CONTAING JSLIDERS FOR CHANGING SCALE OF UI
JMenu menu_scaling = new JMenu("Scaling");
menu_scaling.add(jtext_ver);
menu_scaling.add(jslider_ver);
menu_scaling.add(jtext_hor);
menu_scaling.add(jslider_hor);
menu_scaling.add(new JLabel("Sensitivity"));
menu_scaling.add(jslider_sensitivty);
menu.add(menu_scaling);
/////////////////////////////////////////////////////
//BUTTON CALLED TO ENABLE TEST DATA
jradio_pause.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(Paused){Paused = false;} else {Paused = true;}
}
});
////////////////////////////////////////////
//BUTTON CALLED TO ENABLE TEST DATA
jradio_limit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(limitdata){limitdata = false;} else {limitdata = true;}
}
});
////////////////////////////////////////////f
//BUTTON CALLED TO EXIT
jbut_nightmode.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ThemeManager.toggleNight();
}
});
////////////////////////////////////////////
//BUTTON CALLED TO EXIT
jbut_exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
////////////////////////////////////////////
//RADIO BUTTON CALLING IF YOU DRAW THE PRICE LINE
jradio_price.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(drawPrice){
drawPrice = false;
} else {
drawPrice = true;
}
}
});
/////////////////////////////////////////////
//RADIO BUTTON FOR CALLING HISTORY PLAYER
jradio_replay.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(!rticks_override){
rticks_override = true;
rticks_offset = rticks;
rticks = jslider_replay.getValue();
} else {
rticks_override = false;
}
}
});
/////////////////////////////////////////
//RADIO BUTTON CALLING IF YOU DRAW THE OPEN PRICE
jradio_openprice.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(drawOpen){
drawOpen = false;
} else {
drawOpen = true;
}
}
});
/////////////////////////////////////////////
//RADIO BUTTON CALLING IF YOU DRAW INDICATORS
jradio_indicators.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(drawInd){
drawInd = false;
} else {
drawInd = true;
}
}
});
/////////////////////////////////////////////
jmenu_bar.add(menu);
jmenu_bar.add(jtext_openprice);
jmenu_bar.add(jtext_price);
jmenu_bar.add(jtext_minprice);
jmenu_bar.add(jtext_maxprice);
jmenu_bar.add(jtext_volume);
jmenu_bar.add(jtext_change);
jmenu_bar.add(jtext_clock);
jbut_exit.setBackground(col_secondary);
jbut_nightmode.setBackground(col_secondary);
jmenu_bar.add(jbut_nightmode);
menu.setBackground(col_secondary);
if(fullscreen){
menu.addSeparator();
jmenu_bar.add(jbut_exit);
}
}
| 7 |
private static String [] getArgumentTypes(String functionName) {
if (functionName.equals(NAME_REGEXP_STRING_MATCH))
return regexpParams;
else if (functionName.equals(NAME_X500NAME_MATCH))
return x500Params;
else if (functionName.equals(NAME_RFC822NAME_MATCH))
return rfc822Params;
else if (functionName.equals(NAME_STRING_REGEXP_MATCH))
return stringRegexpParams;
else if (functionName.equals(NAME_ANYURI_REGEXP_MATCH))
return anyURIRegexpParams;
else if (functionName.equals(NAME_IPADDRESS_REGEXP_MATCH))
return ipAddressRegexpParams;
else if (functionName.equals(NAME_DNSNAME_REGEXP_MATCH))
return dnsNameRegexpParams;
else if (functionName.equals(NAME_RFC822NAME_REGEXP_MATCH))
return rfc822NameRegexpParams;
else if (functionName.equals(NAME_X500NAME_REGEXP_MATCH))
return x500NameRegexpParams;
return null;
}
| 9 |
public S_Box RetNextBox(){
//System.out.println("doing while(counter >= t) counter :" + counter + " t: " + t);
if((counter-1) >= t && counter != 0){
return null;
}
if(counter != 0){
PMove();
//System.out.println("E has been moved to: " + E.toString());
}else{
//System.out.println("counter == 0. Not moving E.");
}
S_Box i = VelToBox();
if((double)counter >= CdR && Rem!=0 && CdR != 0){
//System.out.println("Special case has occured. Moving E additionally...");
if(x==t){
if(y>0){
i.loc.y += 1;
PMove(0,1);
}else{
i.size.y += 1;
PMove(0,-1);
}
}else{
if(x>0){
i.size.x += 1;
PMove(1,0);
}else{
i.loc.x += 1;
PMove(-1,0);
}
}
//System.out.println("E has been moved to: " + E.toString());
CdR += dR;
}
counter += 1;
return i;
}
| 9 |
private static void setTableValues(Table table, String[][] values) {
try {
int count = 0;
table.setItemCount(values.length);
for (TableItem item : table.getItems()) {
item.setText(values[count]);
count++;
}
} catch (IndexOutOfBoundsException e) {
showMessage("Cannot set values to table: " + table.getToolTipText(), "Error");
}
}
| 2 |
@Test
public void testReadInWorld() throws Exception {
System.out.println("readInWorld");
String worldFile = "1.world";
World instance = new World();
instance.readInWorld(worldFile);
}
| 0 |
public boolean canRecruitShip(){
for (Territory territory: neighbors){
if (territory instanceof Water && (territory.getFamily()==null ||territory.getFamily()==this.getFamily())){
for (Territory neighborsWaterTerritory :territory.neighbors){
if(neighborsWaterTerritory instanceof Port && neighborsWaterTerritory.getFamily()!=null && neighborsWaterTerritory.getFamily()==this.getFamily()){
return true;
}
}
}
}
return false;
}
| 8 |
private static int findCrossover(int[] input, int k, int start, int end) {
//base cases
if(input[start] > k){
return start;
}
//base cases
if(input[end] < k){
return end;
}
int mid = (start + end)/2;
//if number to find is between mid and its siblings return this mid point
if(input[mid] ==k || (input[mid]<k && input[mid+1]>k) || (input[mid]>k && input[mid-1]<k) ){
return mid;
}
// if x is lesser then left sibling, recurse on left array
if(input[mid]<k && input[mid+1]<k){
return findCrossover(input,k,mid+1, end);
} else {
// else recurse on right
return findCrossover(input,k,start, mid -1);
}
}
| 9 |
@Override
public void run() {
int x = 0;
while (true) {
System.out.println(x++);
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
Logger.getLogger(Threads.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| 2 |
public void Solve() {
ArrayList<String> allPandigital = new ArrayList<String>();
for (int n = 2; n < 10; n++) {
int[] workingSet = new int[n];
for (int i = 0; i < workingSet.length; i++) {
workingSet[i] = i + 1;
}
allPandigital.addAll(Enumerate(workingSet, 0));
}
ArrayList<Integer> pandigitalNumbers = new ArrayList<Integer>();
for (Iterator<String> it = allPandigital.iterator(); it.hasNext();) {
pandigitalNumbers.add(Integer.parseInt(it.next()));
}
Collections.sort(pandigitalNumbers);
List<Integer> primes = Euler.GetPrimes(99999999);
long lastPrimePandigital = 0;
for (Iterator<Integer> it = pandigitalNumbers.iterator(); it.hasNext();) {
Integer number = it.next();
int searchResult = Collections.binarySearch(primes, number);
if (0 <= searchResult) {
lastPrimePandigital = number;
System.out.println(number);
}
}
System.out.println("Result=" + lastPrimePandigital);
}
| 5 |
@Override
public void run() {
synchronized (this) {
if (mWasCancelled) {
return;
}
mWasExecuted = true;
}
try {
if (mKey != null) {
synchronized (PENDING) {
PENDING.remove(mKey);
}
}
if (isPeriodic()) {
long next = System.currentTimeMillis() + mPeriod;
mTask.run();
EXECUTOR.schedule(this, Math.max(next - System.currentTimeMillis(), 0), TimeUnit.MILLISECONDS);
} else {
mTask.run();
}
} catch (Throwable throwable) {
cancel();
Log.error(throwable);
}
}
| 4 |
public Matrix3D minus(Matrix3D B) {
Matrix3D A = this;
if (B.M != A.M || B.N != A.N || B.K != A.K) throw new RuntimeException("Illegal matrix dimensions.");
Matrix3D C = new Matrix3D(M, N, K);
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
for (int l = 0; l < K; l++)
C.data[i][j][l] = A.data[i][j][l] - B.data[i][j][l];
return C;
}
| 6 |
public Map<Integer, Integer> getStatusFrequencyOverHours(){
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for(Record record : log.getRecords()){
Integer hour = record.getTime().getDate().get(Calendar.HOUR_OF_DAY);
Integer number = map.get(hour);
if(number != null){
map.put(hour, ++number);
} else {
map.put(hour, 1);
}
}
return map;
}
| 2 |
public void updateObjectsWithinRange(Collection<Placeable> allObjects, Placeable referencePoint) {
if (!allObjects.isEmpty()) {
clearPlaceablesInRange();
for (Placeable obj : allObjects) {
if (!obj.equals(referencePoint)) {
if (isObjectWithinRange(obj, referencePoint)) {
addToCurrentPlaceablesInRange(obj);
}
}
}
}
}
| 4 |
public TextBox createBox(boolean small) {
TextBox newBox = new TextBox();
newBox.setBorder(new EtchedBorder());
newBox.setHighlighter(null);
if (small) {
newBox.setFont(new java.awt.Font("Monospaced", 0, 10));
} else {
newBox.setFont(new java.awt.Font("Monospaced", 0, 16));
}
newBox.addMouseListener(textBoxListener);
newBox.getDocument().addDocumentListener(new DocListener(newBox));
newBox.addFocusListener(new FocListener(this));
newBox.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_V && evt.isControlDown()) {
paste();
}
if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_X && evt.isControlDown()) {
try {
cut(jPanelWorkspace, buildTree);
} catch (ParseException ex) {
statusBar.println(ex.getMessage());
}
}
if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_C && evt.isControlDown()) {
try {
copy(jPanelWorkspace, buildTree);
} catch (ParseException ex) {
statusBar.println(ex.getMessage());
}
}
}
});
newBox.setColumns(1);
return newBox;
}
| 9 |
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
switch(qName){
case "title":
pub.setTitle(content);
break;
case "year":
pub.setYear(content);
break;
case "author":
pubAuthors.add(content);
break;
case "editor":
pubEditors.add(content);
break;
case "book":
pub.setAuthors(pubAuthors);
pubList.add(pub);
break;
case "incollection":
pub.setAuthors(pubAuthors);
pubList.add(pub);
break;
}
}
| 6 |
private void addBatchParam(String paramName, Integer index, Map<String, Integer> batchParamIndexMap) {
if (batchParamIndexMap == null) {
return;
}
Integer annotationIndex = batchParamIndexMap.get(paramName);
if (annotationIndex != null) {
LOGGER.info("已经存在@BatchParam(\"" + paramName + "\")注解");
return;
}
batchParamIndexMap.put(paramName, index);
batchParamIndexes = (Integer[]) ArrayHelper.add(batchParamIndexes, new Integer(index));
}
| 2 |
public static List<String> executeCode(String op){
if(op.equals("Run")){
int i = 0;
while( i < mem.length ){
if(pc<2000){
CU.fetch(pc);
CU.decode(ir);
CU.execute();
}
else{
break;
}
i++;
}
Registers.setValues(pc, ir, reg);
return Registers.getValues();
}
else if(op.equals("Step")){
CU.fetch(pc);
CU.decode(ir);
CU.execute();
Registers.setValues(pc, ir, reg);
return Registers.getValues();
}
return null;
}
| 4 |
@Override
public boolean next() {
if (pointer < rows.size() && pointer + 1 != rows.size()) {
pointer++;
currentRecord = new RowRecord(rows.get(pointer), metaData, parser.isColumnNamesCaseSensitive(), pzConvertProps, strictNumericParse,
upperCase, lowerCase, parser.isNullEmptyStrings());
return true;
}
currentRecord = null;
return false;
}
| 2 |
@Override public void paivita()
{
if(onValmis())
{
putoamiskohta = 0;
tutkiPaivityksiaPelialueelta();
}
else if(muutostenAjastaja.onKulunut(20))
{
poistot.paivita();
if(siirrot.onLaukaistu())
siirrot.paivita();
muutostenAjastaja.paivita();
}
}
| 3 |
public AnnotationVisitor visitAnnotation(final String name,
final String desc) {
if (values == null) {
values = new ArrayList(this.desc != null ? 2 : 1);
}
if (this.desc != null) {
values.add(name);
}
AnnotationNode annotation = new AnnotationNode(desc);
values.add(annotation);
return annotation;
}
| 3 |
public boolean isPalindrome(String s) {
if(s.equals("")){
return true;
}
s = s.toLowerCase();
StringBuilder clearStr = new StringBuilder();
for(int i=0; i<s.length(); i++){
char c = s.charAt(i);
if(c>=48 && c<=57){
clearStr.append(c);
}
if(c>=97 && c<=122){
clearStr.append(c);
}
}
String str = clearStr.toString();
String reverseStr = clearStr.reverse().toString();
if(str.equals(reverseStr)){
return true;
}
return false;
}
| 7 |
public Date getDataChiusura() {
return dataChiusura;
}
| 0 |
public String toString() {
String result = "";
Iterator<Entry<PieceCoordinate, HantoPiece>> pieces = board.entrySet().iterator();
HantoPiece piece;
PieceCoordinate coordinate;
String color;
while(pieces.hasNext()) {
Entry<PieceCoordinate, HantoPiece> entry = pieces.next();
coordinate = entry.getKey();
piece = board.get(coordinate);
color = piece.getColor() == HantoPlayerColor.RED ? "RED" : "BLUE";
result += piece.getType().getPrintableName() + " " + color + " " + coordinate.toString() + "\n";
}
return result;
}
| 2 |
public Wave09(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 110; i++){
if(i < 35){
if(i % 2 == 0)
add(m.buildMob(MobID.EKANS));
else
add(m.buildMob(MobID.SPEAROW));
}
else{
if(i % 2 == 0)
add(m.buildMob(MobID.POLIWAG));
else if(i % 3 == 0)
add(m.buildMob(MobID.PSYDUCK));
else
add(m.buildMob(MobID.GOLDEEN));
}
}
}
| 5 |
public static void loadChunk(Chunk chunk,World world,int x,int z){
int[] regPosition = PositionUtil.getChunkRegion(x, z);
Region reg = world.getDimension().get(regPosition[0], regPosition[1]);
if(chunk == null){
if(reg == null)return;
reg.unloadChunks(x, z);
return;
}
if(reg == null){
reg = new Region(regPosition[0], regPosition[1],world.getDimension());
world.getDimension().loadRegion(reg);
}
reg.loadChunks(chunk);
}
| 3 |
public void listen() {
listen = new Thread("Listen") {
public void run() {
while (running) {
String message = client.receive();
if (message.startsWith("/c/")) {
client.setID(Integer.parseInt(message.split("/c/|/e/")[1]));
console("Successfully connected to server! ID: " + client.getID());
} else if (message.startsWith("/m/")) {
String text = message.substring(3);
text = text.split("/e/")[0];
console(text);
} else if (message.startsWith("/i/")) {
String text = "/i/" + client.getID() + "/e/";
send(text, false);
} else if (message.startsWith("/u/")) {
String[] u = message.split("/u/|/n/|/e/");
users.update(Arrays.copyOfRange(u, 1, u.length - 1));
}
}
}
};
listen.start();
}
| 5 |
@Override
public List<SocialCommunity<?>> getCommunities(String query, Integer page) {
List<GroupDto> groupDtos = getGroups(new GroupRequestBuilder(
Strings.nullToEmpty(query)).setOffset(PAGE_COUNT * page)
.setCount(PAGE_COUNT).build());
return Lists.transform(groupDtos,
new Function<GroupDto, SocialCommunity<?>>() {
@Override
public SocialCommunity<?> apply(GroupDto object) {
return CommunityType.VK
.getSocialCommunityInstance(object);
}
});
}
| 3 |
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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ImportExport.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ImportExport.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ImportExport.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ImportExport.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ImportExport().setVisible(true);
}
});
}
| 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.