text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void processAsXML(ByteArrayOutputStream bytes) {
ByteArrayInputStream input = new ByteArrayInputStream(bytes.toByteArray());
try {
TransformerFactory factory = TransformerFactory.newInstance();
Transformer xformer = factory.newTransformer();
Source source = new StreamSource(input);
Document... | 6 |
public void undo(){
Command commande = commandeCourante.commande;
commande.undo();
//Actualisation du modèle puis de la vue.
if(commande instanceof LirePlanCommand){
zone = ((LirePlanCommand)commande).getZone();
Fenetre.getInstance().actualiserPlan();
... | 6 |
private boolean verfiyeTextField(){
boolean r = true;
if (lectureName.isEmpty()){
JOptionPane.showMessageDialog(mainForm,
"Lecture text is empty",
"Error",
JOptionPane.ERROR_MESSAGE);
return false;
}
else if (tag.isEmpty()){
JOptionPane.showMessageDialog(mainForm,
"Tag t... | 8 |
public static String shortName(final Class c) {
final String n = c.getName();
final int i = n.lastIndexOf(".");
return i == -1 || i == n.length() ? n : n.substring(i+1);
} | 2 |
public final Level loadOnline(String var1, String var2, int var3) {
if(this.progressBar != null) {
this.progressBar.setTitle("Loading level");
}
try {
if(this.progressBar != null) {
this.progressBar.setText("Connecting..");
}
HttpURLConnection var6;
... | 8 |
public void move()
{
// Controls wrap around in the x-axis
if (x >= fWidth)
{
double temp = middleX - x;
x = -1 * image.getWidth(null);
middleX = x + temp;
}
else if (x <= -image.getWidth(null))
{
double temp = ... | 4 |
public boolean growPumpkins(Player player, String[] args, int radius) {
Block playerCenter = player.getLocation().getBlock(); // Get Centrepoint (Player)
int pumpkins = 0;
for (int x = -radius; x < radius; x++) {
for (int y = -radius; y < radius; y++) {
for (int z = -radius; z < radiu... | 6 |
public void insertarDespuesDeX(T dato, T x){
Nodo<T> nodoQ = this.inicio;
Nodo<T> nodoT = null;
boolean bandera = true;
if(this.inicio == null){
this.inicio = new Nodo<T>(dato);
}else{
while(nodoQ.getInfo() != x && bandera){
if(nodoQ.getLiga() != null){
nodoQ = nodoQ.getLiga();
}else{
... | 5 |
public Date nextTimePeriod(){
String c = sdf.format(periodStartDate);
int month = Integer.parseInt(c.substring(5,7));
int day = Integer.parseInt(c.substring(8,10));
int year = Integer.parseInt(c.substring(0,4));
if(day == 1){
day = 16;
}else{
day = 1;
month++;
if(month > 12){
month %= 12;... | 5 |
private void checkFull(Node node) {
for (Node n : node.children) {
if (n == null)
return; // not full, nothing to do
else if (n.full == false)
return; // not full, nothing to do
}
// all children are full, flag and check recursively upwards
node.full = true;
if (node != root)
checkFull(nod... | 4 |
public static Grandeur getGrandeurFromString(String grandeur) {
Grandeur ret;
switch (grandeur.toUpperCase()) {
case "LONGUEUR":
ret = Grandeur.LONGUEUR;
break;
case "TEMPS":
ret = Grandeur.TEMPS;
break;
... | 7 |
public void piirraRobotti(Pelaaja pelaaja, Graphics g){;
Robotti robo=pelaaja.getRobotti();
switch (pelaaja.getMones()){
case 1:g.setColor(Color.blue);
break;
case 2:g.setColor(Color.red);
break;
case 3:g.setColor(Color.GREEN);
... | 7 |
public GrahamScan(Point2D[] pts) {
// defensive copy
int N = pts.length;
Point2D[] points = new Point2D[N];
for (int i = 0; i < N; i++)
points[i] = pts[i];
// preprocess so that points[0] has lowest y-coordinate; break ties by x-coordinate
// points[0] is an... | 8 |
public static String getMacBytesAsString(byte[] data, int startOffset) {
StringBuilder sb = new StringBuilder(18);
for (int i = startOffset; i < startOffset + 6; i++) {
byte b = data[i];
if (sb.length() > 0)
sb.append(':');
sb.append(String.format("%02x", b));
}
return sb.toString();
} | 2 |
public static void main(String[] args) {
double c1,c2,c3;
int exp;
double a,b,xr,fa,fb,fxr,error,eact;
double eaux=0;
Scanner lector = new Scanner(System.in);
System.out.println("Dame el coeficiente del termino cuadratico");
c1=lector.nextDouble();
System.out.println("Dame el exponente del termino ... | 3 |
public static void clearInventory(InventoryItem[] targetInventory)
{
for(int i = 0; i<getInventorySize(targetInventory); i++)
{
targetInventory[i] = Parasite.items.EmptyItem;
}
} | 1 |
public static void killMeIfIGetStuck() {
final Thread threadToKill = Thread.currentThread();
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
if (threadToKill.getState().equals(State.RUNNA... | 3 |
protected void onGuiEvent(GuiEvent ev) {
// ----------------------------------------
command = ev.getType();
if (command == QUIT) {
try {
home.kill();
for (int i = 0; i < container.length; i++) container[i].kill();
}
catch (Exception e) { e.printStackTrac... | 8 |
private Token scanTag () {
char ch = peek(1);
String handle = null;
String suffix = null;
if (ch == '<') {
forward(2);
suffix = scanTagUri("tag");
if (peek() != '>') throw new TokenizerException("While scanning a tag, expected '>' but found: " + ch(peek()));
forward();
} else if (NULL_BL_T_LINEBR.... | 7 |
@Override
protected AcceptStatus accept(final BytesRef term) {
if (commonSuffixRef == null || StringHelper.endsWith(term, commonSuffixRef)) {
if (runAutomaton.run(term.bytes, term.offset, term.length))
return linear ? AcceptStatus.YES : AcceptStatus.YES_AND_SEEK;
else
return (linear &&... | 8 |
public static void unifyTypes(Proposition prop, Skolem term1, Stella_Object term2) {
{ Surrogate type1 = Logic.logicalType(term1);
Surrogate type2 = Logic.logicalType(term2);
if ((type1 == type2) ||
(Logic.logicalSubtypeOfP(type1, type2) ||
Logic.logicalSubtypeOfP(type2, type1))) {... | 8 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Coordinate that = (Coordinate) o;
if (x != that.x) return false;
if (y != that.y) return false;
return true;
} | 5 |
@Override
public String getWeaponLimitDesc()
{
final StringBuffer str=new StringBuffer("");
if((disallowedWeaponClasses(null)!=null)&&(disallowedWeaponClasses(null).size()>0))
{
str.append(L("The following weapon types may not be used: "));
for(final Iterator i=disallowedWeaponClasses(null).iterator();i.h... | 7 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String url;
request.setAttribute("active", "manageUsers");
String firstName = request.getParameter("firstName");
String lastName = request.ge... | 8 |
public void go_top()
{
if(order.length()>0)
{
if(Idx!=null)
{
Idx.goTop();
go_recno( Idx.found ? Idx.sRecno : 0 );
}
else
{
Cdx.goTop();
go_recno( Cdx.found ? Cdx.sRecno : 0 );
}
}
else go_recno(1);
} | 4 |
private void fixParent(Node parent, Node alipuu, Node p) {
// p on poistetun vanhempi
if (parent == null) {
this.root = alipuu;
} else if (parent.left == p) {
parent.left = alipuu;
} else {
parent.right = alipuu;
}
if (parent != null) {... | 3 |
private static void displayConfiguration() {
logger.info("Configuration loaded:");
Enumeration<?> e = properties.propertyNames();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
logger.info("\"" + key + "\":\"" + properties.getProperty(key) + "\"");
}
} | 2 |
private boolean isLeave(TreeNode node) {
if(node.left == null && node.right == null) return true;
return false;
} | 2 |
@Test
public void setNextFigure() {
HashMap<String, Integer> figureQuantityMap = new HashMap<>();
figureQuantityMap.put(KING.getFigureAsString(), 1);
FiguresChain figuresChain = new Bishop(figureQuantityMap);
FiguresChain figuresChain1 = new Queen(figureQuantityMap);
figures... | 1 |
protected final static String createSignature(String className, Method method)
{
String signature = className + "." + method.getName() + "(";
Class<?> types[] = method.getParameterTypes();
if(types.length > 0) {
for(int i = 0; i < types.length - 1; i++)
signature += types[i].getName() + ",";
signature ... | 3 |
public static void main(String args[])
{
Digraph G = null;
try
{
G = new Digraph(new In(args[0]));
System.out.println(args[0] + "\n" + G);
}
catch (Exception e)
{
System.out.println(e);
System.exit(1);
}
OrderDirectedDFS order = new OrderDirectedDFS(G);
System.out.println("Post order o... | 3 |
@Override
public Class<?> getColumnClass(int columnIndex) {
switch(columnIndex){
case 0 :
return Integer.class;
case 1 :
return String.class;
case 2 :
return Integer.class;
case 3 :
return Intege... | 5 |
public static ArrayList<Device> getDevicesList(String in){
try{
FileInputStream input = new FileInputStream(in);
XMLDecoder decoder = new XMLDecoder(input);
while(result.size() < 3){
Object obj = decoder.readObject();
int option = getDeviceCode(obj);
switch (option) {
case 1:
if (contain... | 9 |
public QueryDefinition createQuerty(String name, Class<? extends JPanel> panel, Environment env) throws Exception {
Node node = null;
try {
Element queryElem = getOrCreateCollection("queries");
node = Utilities.selectSingleNode(queryElem, "./c:query[@c:name='" + name + "']", this.namespaces);
if(node ==... | 3 |
private JSONArray readArray(boolean stringy) throws JSONException {
JSONArray jsonarray = new JSONArray();
jsonarray.put(stringy
? read(this.stringhuff, this.stringhuffext, this.stringkeep)
: readValue());
while (true) {
if (probe) {
lo... | 7 |
protected static String processURL(String txt) {
int index = txt.indexOf(" ");
String url = txt;
String label = txt;
if (index != -1) {
url = txt.substring(0, index);
label = txt.substring(index + 1);
}
return "<a href=\"" + url + "\">" + label + "... | 1 |
private void mapTasksToFile(List<String> tasks, IFile file) {
//first remove existing mappings for this file
// List<String> keysToRemove = new ArrayList<String>();
// for (Entry<String, IFile> entry : taskToFileMap.entrySet()) {
// if (entry.getValue().equals(file)) {
// keysToRemove.add(entry.getKey());
// ... | 1 |
public static void printSymbol(Symbol self, PrintableStringWriter stream) {
{ boolean visibleP = self == Symbol.lookupSymbolInModule(self.symbolName, ((Module)(Stella.$MODULE$.get())), false);
Module module = ((Module)(self.homeContext));
if (!visibleP) {
if (self.symbolId == -1) {
st... | 6 |
public void paint(Graphics g, TicTacToePlayer playerObj) {
Graphics2D g2 = (Graphics2D) g;
Font scoreFont = new Font("monospaced", Font.BOLD, 18);
Font numberFont = new Font("consolas", Font.PLAIN, 18);
Font gameOverFont = new Font("monospaced", Font.BOLD, 25);
Color background... | 9 |
public Integer[][] paintFill(int x, int y, int color, Integer[][] grid){
if(grid[x][y] == color){
return grid;
}
else{
grid[x][y] = color;
if(x<grid.length-1){
paintFill(x+1, y, color, grid);
}
if(x>0){
paintFill(x-1, y, color, grid);
}
if(y>0){
... | 5 |
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
case CMD_START:
game.startGame();
break;
case CMD_CONTINUE:
game.continueGame();
break;
}
} | 2 |
@Override
public void run() {
ArrayList<Meld> play, trivialPlay;
Boolean playMade;
try {
startNewGame();
while (!game.isGameOver()) {
updateRound();
playMade = false;
System.out.println(game.displayGame());
printStatus("Current Hand : " + hand.toString());
if(initi... | 8 |
public void removeAllInferenceListeners() {
synchronized (inferenceListeners) {
Object[] listenerArray = inferenceListeners.getListenerList();
for (int i = 0, size = listenerArray.length; i < size; i += 2) {
inferenceListeners.remove((Class) listenerArray[i],
(EventListener) list... | 1 |
protected void onRemoveChannelKey(String channel, String sourceNick, String sourceLogin, String sourceHostname, String key) {} | 0 |
private int intTupleToInt(TupleExpression msg) {
if (msg.getTupleType().equals("Z")) {
return 0;
}
else if (msg.getTupleType().equals("I") && msg.getElements().size() == 1
&& msg.getElements().get(0) instanceof TupleExpression) {
return 1 + intTupleToInt((TupleExpression)msg.getElements(... | 4 |
public void fillRect(int x, int y, int w, int h, int pix) {
assert data instanceof int[];
for (int ry = y; ry < y + h; ry++)
for (int rx = x; rx < x + w; rx++)
((int[])data)[ry * width_ + rx] = pix;
} | 2 |
protected final boolean needReload(String shop, int id, int data) {
if (cacheTimeout > 0 && data >= 0) {
if (id <= 0) {
id = data = 0;
}
if (shop == null) {
if (id == 0) {
// full db
return System.currentTimeMillis() - lastReload > cacheTimeout;
} else {
// global shop
shop = ... | 9 |
public static URL getURL(String link) {
if(link == null || link.equals("")) return null;
URL url = null;
try {
url = new URL(link);
} catch (MalformedURLException e) {
if(!link.startsWith("http://") && !(link.startsWith("https://"))) {
link = "... | 6 |
public static void saveGraph(Component apane, JComponent c, String description, String format){
if (apane instanceof EditorPane){
apane = ((EditorPane)apane).getAutomatonPane();
}
Image canvasimage = apane.createImage(apane.getWidth(),apane.getHeight());
... | 6 |
public String toString() {
try {
return this.toJSON().toString(4);
} catch (JSONException e) {
return "Error";
}
} | 1 |
private HashMap<String,HashSet<String>> BuildGraph(){
HashMap<String,HashSet<String>> g = new HashMap<String,HashSet<String>>();
for(String str : m_nonterminals){
g.put(str,new HashSet<String>());
}
for(Rule cur_rule : m_rules){
if(m_nonterminals.contains(cur_rule... | 3 |
public void setElementConflictConditionToAll(AbstractElement e, Condition c) {
if (e == null)
throw new NullPointerException("The element is null.");
if (c == null)
throw new NullPointerException("The condition is null.");
RETW(defaultEngineLock, () -> {
eleme... | 5 |
private static boolean checkAll(int arrIdx, int ch, int charIdx) {
int errCnt = 0;
for (int j = 0; j < cts.length; j++) {
if (j == arrIdx || ct[j].length <= charIdx)
continue;
int x = (ch ^ ct[j][charIdx]);
if (x == 0)
continue;
if (!((x >= 'A' && x <= 'Z') || (x >= 'a' && x <= 'z'))) {
errC... | 9 |
private String readLine() {
String line = null;
do {
if (this.currentThread.isInterrupted()) {
this.log.info("MessageReceiver thread is Interrupted");
finishFileReceiverThread();
return null;
}
try {
if (this.inputMessageReceiver.ready())
line = this.inputMessageReceiver.readLine();
... | 4 |
static protected void UpdateLineColumn(char c)
{
column++;
if (prevCharIsLF)
{
prevCharIsLF = false;
line += (column = 1);
}
else if (prevCharIsCR)
{
prevCharIsCR = false;
if (c == '\n')
{
prevCharIsLF = true;
}
else
... | 6 |
final void method3770(int i, Interface11 interface11) {
do {
try {
anInt7598++;
if (((OpenGlToolkit) this).aBoolean7815) {
method3805(8387, interface11);
method3764(-17083, interface11);
} else {
if (anInt7746 < 0
|| anInterface11Array7743[anInt7746] != interface11)
throw new Runtime... | 8 |
public boolean getLinhaVenda(int id)throws ExceptionGerenteVendas {
for (LinhaVenda v : linhas) {
if (v.getId()==(id)) {
return true;
}
}
throw new ExceptionGerenteVendas("Linha de venda n�o existe!");
} | 2 |
public void update(int base, int comp) {
if ((base == this.base) && (comp == this.comp))
return;
int delta = (this.base > 0) ? base - this.base : 0;
if(delta > 0) {
UI.instance.cons.out.println("Your "+nm.toUpperCase()+" raised by "+delta+" points");
}
this.base = base;
this.comp = comp;
se... | 4 |
public static void main( String[] args ) throws LWJGLException
{
Controllers.create();
Controllers.poll();
for ( int i = 0; i < Controllers.getControllerCount(); i++ )
{
controller = Controllers.getController( i );
System.out.println( "(" + i + ") " + control... | 6 |
public static boolean isRedirectCode(int statusCode) {
return (statusCode == HttpStatus.SC_MOVED_TEMPORARILY)
|| (statusCode == HttpStatus.SC_MOVED_PERMANENTLY)
|| (statusCode == HttpStatus.SC_SEE_OTHER)
|| (statusCode == HttpStatus.SC_TEMPORARY_REDIRECT);
} | 3 |
public void setComments(List<String> comments) {
this.comments = comments;
} | 0 |
public boolean equals (Month m)
{
if (m.getNum()==this.getNum())
return true;
else
return false;
} | 1 |
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (screen != null) result = screen.screen;
for (int x = 0; x < cellsX; x++) {
for (int y = 0; y < cellsY; y++) {
switch (result[x][y]) {
case 0:
g.setColor(Color.BLACK);
g.fillRect(x * c... | 8 |
public void input(InputRouter.Interaction action) {
if (isAlive())
inputAlive(action);
else {
RespawnMenu.setRespawnOpen(true);
switch(action) {
case MENU_UP:
RespawnMenu.selectionUp();
break;
cas... | 4 |
public static void diffStuff()
{
// Get the path of current directory
Path currentDir = Paths.get(System.getProperty("user.dir"));
// Manipulate the paths to point to specific files.
Path pathToFileA = currentDir.resolve("../src/DemoMain.java");
Path pathToFileB = currentDir.resolve("../src/DemoDbManager.ja... | 4 |
public static List<Fournisseur> selectFournisseur() throws SQLException {
String query = null;
List<Fournisseur> fournisseurs = new ArrayList<Fournisseur>();
ResultSet resultat;
try {
query = "SELECT * from FOURNISSEUR ";
PreparedStatement pStatement = (Prepared... | 2 |
double purity(String codon, String around) {
String pre = around.substring(0, CODONS_SIZE * CODONS_AROUND);
String post = around.substring(around.length() - CODONS_SIZE * CODONS_AROUND);
if( debug ) Gpr.debug("codon: '" + codon + "'\tAround: '" + around + "'\tpre: '" + pre + "'\tpost: '" + post + "'");
// Coun... | 3 |
private void fillConceptTable(Bill r, Student s, JTable table) {
DefaultTableModel dtm = (DefaultTableModel) table.getModel();
for (int i = 0; i < dtm.getRowCount(); i++) {
dtm.removeRow(i);
}
Set<BillLine> billLines = billService.getBillLinesByStudent(r, s);
for (BillLine rl : billLines) {
Object[] da... | 2 |
public boolean parkIsNull() {
return this.park == null;
} | 0 |
public void actionPerformed(ActionEvent actionEvent) {
if (actionEvent.getActionCommand().equals("Cut")) {
if (tf != null) {
tf.cut();
} else {
ta.cut();
}
}
if (actionEvent.getActionCommand().equals("Copy")) {
if (t... | 6 |
public void SemanticOperationDistribute(int id){
//功能:
//根据Id调用对应语义推理模块的处理程序
if(id>=1 && id<100){
reiMainSpace.Process(id);
}
else if(id>=101 && id<200){
reiImageSpace.Process(id);
}
else if(id>=201 && id<500){
reiAttributeSpace.Process(id);
}
else if(id>=1001){
Process(id);
}
else ... | 8 |
public void setPcaSubgru(Integer pcaSubgru) {
this.pcaSubgru = pcaSubgru;
} | 0 |
public void renderProjectile(int xp, int yp, Projectile p) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < p.getSpriteSize(); y++) {
int ya = y + yp;
int ys = y;
for (int x = 0; x < p.getSpriteSize(); x++) {
int xa = x + xp;
int xs = x;
if (xa < -p.getSpriteSize() || xa >= width || ya < 0... | 8 |
@EventHandler
public void onSignInteract(PlayerInteractEvent e){
Player player = e.getPlayer();
if(e.getAction() == Action.RIGHT_CLICK_BLOCK && e.hasBlock() && e.getClickedBlock().getState() instanceof Sign){
Sign sign = (Sign) e.getClickedBlock().getState();
if(sign.getLine(0).equalsIgnoreCase(ChatColor.D... | 9 |
public String giveRandomCard() {
String nameOfCard = null;
int w = random.nextInt(52);
if (deck[w].cardValue == 1) {
nameOfCard = "A" + deck[w].suit;
} else if (deck[w].cardValue == 11) {
nameOfCard = "J" + deck[w].suit;
} else if (deck[w].cardValue == 12) {
nameOfCard = "Q" + deck[w].suit;
... | 4 |
private SongLogger()
throws LogException {
SongLogger.log= Logger.getLogger(SongLogger.class.getName());
FileHandler fh= null;
try {
fh = new FileHandler("LogSong " + new Date().toString());
SongLogger.log.addHandler(fh);
SongLogger.log.setUseParentHandlers(false);
} catch (SecurityEx... | 3 |
private static double getDScale(int factor)
{
if (factor < SCALES.length)
{
return SCALES[factor];
}
else if (factor < 2 * SCALES.length)
{
return SCALES[factor - SCALES.length] * (double) SCALES[SCALES.length - 1];
}
else
{
throw new IllegalArgumentException("Too high factor");
}
} | 2 |
public void updateLayerBox() {
int j = 0;
removeAll();
MainImagePanel mip = MainImagePanel.getInstance();
for (BufferedImage i : mip.getLayers()) {
BufferedImage newi = new BufferedImage(LAYER_ICON_SIZE, LAYER_ICON_SIZE, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = newi.createGraphics();
g2d.drawImage... | 2 |
@SuppressWarnings("unchecked")
public static double mean(Function w, HashSet<Integer> id, boolean inclusion,
double threshold, boolean above) {
double result = 0.0;
int counter = 0;
for (Feature f : (LinearFunction<Feature,FeatureVector>) w) {
if (((inclusion && id.contains(f.identifier())) || (!inclusion... | 9 |
public ArrayList<Object> getInfoFromPDB(ArrayList<String> pdbFile) {
//empty at beginning
ArrayList<Atom> atomList = new ArrayList<Atom>();
CartesianCoord coords;
String atomType, pdbResNum;
//default double value is 0
double tempFact, meanBFactor, std, totalBFactor=0, totalSquaredBF... | 4 |
@Override
public synchronized
boolean saveResult(ProgressReporter reporter) throws IOException, InterruptedException {
Path p = Paths.get(saveTo, getFSSafeName(getTitle()));
Files.createDirectories(p);
if (WebDownloader.fetchWebFile(coverUrl, getCoverSavePath(), reporter) != 0) {
reporter.report("cover ... | 1 |
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... | 6 |
public synchronized void forward(int gameID, String data) {
// hier wird der String in seine Einzelteile zerlegt
// (Zieladresse, Name, Nachricht)
try {
StringTokenizer ST = new StringTokenizer(data);
String player = ST.nextToken();
String name = ST.nextToken();
String msg = data.sub... | 6 |
private void loadAvalibleData() {
// fill cbKompetens
cbKompetens.removeAllItems();
try {
ArrayList<String> komptemp = DB.fetchColumn("select kid from kompetensdoman");
ArrayList<Kompetensdoman> komp = new ArrayList<>();
for (String k : komptemp) {
... | 7 |
public MacroCreation() {
temp_body = new ArrayList<Code>(1);
add(pB, BorderLayout.SOUTH);
add(pL, BorderLayout.CENTER);
add(mBL, BorderLayout.WEST);
add(mN, BorderLayout.NORTH);
// When user clicks Save Button
mN.ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEv... | 7 |
@Override
public void stop(boolean success) {
if (connection != null) {
try {
if (success) {
connection.commit();
}
else {
connection.rollback();
}
}
catch (SQLException e) {
System.out.println("Could not end transaction");
e.printStackTrace();
}
finally {
safeC... | 3 |
public void subscribeUsersFinished(int type)
throws InvalidSubscriptionException, IOException {
usersHaveData = 1;
String tmp;
final int nonce;
if (type == FINISHED_DEC_HAND) {
tmp = HAVE_MY_HAND;
nonce = SigService.HAVE_HAND_NONCE;
} else if (type == FINISHED_DEC_COM_CARDS) {
tmp = REQUEST_RAW... | 6 |
@Override
public void run()
{
plateau1.run();
plateau2.run();
} | 0 |
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://downl... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
BigramModel<T,K> other = (BigramModel<T,K>) obj;
if (key == null) {
if (other.key != null) {
return false;
}
}
els... | 9 |
public void setStep(int step)
{
this.step = step;
} | 0 |
public int[] twoSum(int[] numbers, int target) {
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
int[] result = new int[2];
int n = numbers.length;
for(int i = 0; i< numbers.length; i++ ){
if(map.containsKey(target-numbers[i])){
result... | 2 |
public static void main (String[] argv){
System.out.println("Starting mapfold controller system");
try{
String workerConfPath = "conf/server_conf.json";
String jobConfPath = "conf/job.json";
if(argv.length > 0){
workerConfPath = argv[0];
}... | 7 |
public void shots(){
if (bullet.isShot()){
Bullet bullet1 = new Bullet();
bullet1.setX(paddle.getX() + (paddle.getWidth() - bullet1.getWidth()) / 2);
bullet1.setY(paddle.getY() + (paddle.getHeight() - bullet1.getHeight()) / 2);
bulletList.add(bullet1);
}
} | 1 |
public static void validateDirection(Direction direction) throws TechnicalException {
if (direction == null) {
throw new TechnicalException(MSG_ERR_NULL_ENTITY);
}
if ( ! isStringValid(direction.getName(), DIRECT_NAME_SIZE)) {
throw new TechnicalException(NAME_ERROR_MSG);... | 6 |
@Override
public Object fromMessage(Message message) throws MessageConversionException {
try {
Map data = converter.toMap(new String(message.getBody(), "UTF-8"));
return new MyCustomEventApplicationEvent(this, data);
} catch(IOException e) {
throw new MessageConve... | 1 |
private Method findActionMethod(Class<?> type, String methodName) {
List<Method> methods = new ArrayList<Method>();
Action detail = null;
for (Method method : type.getDeclaredMethods()) {
if (!isMethodValid(method, methodName)) {
continue;
}
Ac... | 9 |
public ParkException(String msg) {
super(msg);
} | 0 |
private void endGame(int i) {
isInGamePlay = false;
for (Cell[] cellArray : cells) {
for (Cell cell : cellArray) {
cell.reveal();
}
}
if (listener != null) {
if (i == -1)
listener.gameFinished(false);
else ... | 5 |
public boolean processXML(File file,Document doc,boolean forceRefresh) throws Exception {
Element root=doc.getDocumentElement();
List<FragmentDirective> fragments=new ArrayList<FragmentDirective>();
scanComments(root,fragments);
MessageDigest digest=MessageDigest.getInstance("SHA-1");
... | 9 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.