text stringlengths 14 410k | label int32 0 9 |
|---|---|
public synchronized boolean isValid(){
try {
MessageDigest hasher = MessageDigest.getInstance("SHA");
byte[] result = hasher.digest(this.getData());
hasher.reset();
if(result.length != hash.length){
System.err.println("Hash check for piece " + this.index + " failed with hash length mismatch.");
re... | 4 |
public static void chooseBestHand(BlackjackPlayer player) {
int playerDefaultScore = player.getDefaultScore();
int playerChangedAceScore = player.getChangedAceScore();
System.out.println("The score with the ace value as 1: " + playerDefaultScore);
System.out.println("The score with the ace value as 11: " + pla... | 4 |
private synchronized void seed() {
// Silently ignore if we're already seeding.
if (ClientState.SEEDING.equals(this.getState())) {
return;
}
logger.info("Download of " + this.torrent.getPieceCount() +
" pieces completed.");
if (this.seed == 0) {
logger.info("No seeding requested, stopping client..... | 3 |
public boolean isSpaceForCar(VehicleAcceptor r) {
List<Vehicle> cars = r.getCars();
if (cars == null) {
return true;
}
for (Vehicle c: cars) {
if (c.getBackPosition() <= this.getLength()) {
//System.out.println("Not Enough Room for " + this + " b/c " + c);
return false;
}
}
return true;
} | 3 |
@EventHandler
public void WitchWaterBreathing(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWitchConfig().getDouble("Witch.Wat... | 6 |
@Override
public void run() {
while (!mainFrame.isGameOver()) {
try {
Thread.sleep(CYCLE_SLEEP_TIME);
if (!mainFrame.isPause()) {
cyclesCount++;
// move down if needed
int gravity = mainFrame.getLevel();
if (cyclesCount>=AUTO_MOVE_DOWN_MAX_CYCLES / gravity) {
cyclesCount = 0;... | 4 |
private int calcPlusDef() {
if (plus <= 0 || plus > 15) {
return 0;
}
if (typ.equals(ItemTyp.PLATE)) {
return plus_plate[plus];
}
if (typ.equals(ItemTyp.HEAVY)) {
return plus_heavy[plus];
}
if (typ.equals(ItemTyp.LIGHT)) {
return plus_light[plus];
}
return plus_cloth[plus];
} | 5 |
private void FormaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FormaActionPerformed
// TODO add your handling code here:
if((Vias.getSelectedItem()!="Vias de administracion") && (Forma.getItemCount())!=0){
if(Forma.getSelectedItem().equals("Forma")){
Tip... | 4 |
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Pair<?, ?>)) {
return false;
}
Pair<?, ?> otherPair = (Pair<?, ?>) obj;
return isEqualOrNulls(first, otherPair.getFirst())
&& isEqualOrNulls(second, otherPair.getSecond());
} | 8 |
public void invokeMain(String sClass, String[] args) throws Throwable {
Class<?> clazz = loadClass(sClass);
log("Launch: %s.main(); Loader: %s", sClass, clazz.getClassLoader());
Method method = clazz.getMethod("main", new Class<?>[] { String[].class });
boolean bValidModifiers =... | 9 |
public static void main(String[] args) {
ExecutorImplClassDemo executorImplClassDemo = new ExecutorImplClassDemo();
CompoundExecutorDemo compoundExecutorDemo = new CompoundExecutorDemo(executorImplClassDemo);
ExecutorImplClassDemo.RunnableImpl runnable = new ExecutorImplClassDemo.RunnableImpl();... | 1 |
void updateButtons(Set<Direction> valids)
{
for ( DirectionButton b: this.buttons.values() )
b.setVisible(false);
if ( ( valids == null ) || ( valids.isEmpty() ) )
{
this.setVisible(false);
return;
}
for ( Direction d: valids )
... | 4 |
public boolean isPressedOnce(int key) {
if (this.keys.containsKey(key) && this.keys.get(key)) {
if (!this.pressed.containsKey(key) || !this.pressed.get(key)) {
this.pressed.put(key, true);
return true;
}
}
return false;
} | 4 |
private boolean jj_3_16() {
if (jj_3R_34()) return true;
return false;
} | 1 |
private static int getBits(int i, BZip2BlockEntry blockEntry) {
int j;
do {
if (blockEntry.anInt577 >= i) {
int k = blockEntry.anInt576 >> blockEntry.anInt577 - i & (1 << i) - 1;
blockEntry.anInt577 -= i;
j = k;
break;
}
blockEntry.anInt576 = blockEntry.anInt576 << 8 | blockEntry.inputBuffe... | 3 |
public static void main(String[] args) throws Exception
{
HashMap<String, RawDesignMatrixParser> map = RawDesignMatrixParser.getByFullId();
List<String> bioinformaticsIds = RawDesignMatrixParser.getAllBioinformaticsIDs(map);
//for(String s : bioinformaticsIds)
// System.out.println(s);
List<String> tax... | 7 |
public void replace(FilterBypass filterBypass, int offset, int length, String string, AttributeSet attributeSet)
throws BadLocationException {
super.replace(filterBypass, offset, length, string, attributeSet);
Document doc = filterBypass.getDocument();
_preText = doc.getText(0, doc.getLength(... | 8 |
public void setTransforms(TransformsType value) {
this.transforms = value;
} | 0 |
@Override
public void show_TrisA(Integer value) {
PIC_Logger.logger.info("Showing Tris A");
int x=7;
for(int i = 0; i < 8; i++){
if( (value & (int)Math.pow(2, i)) == (int)Math.pow(2, i)){
regA.setValueAt("i", 0, x+1);
}
else{
regA.setValueAt("o", 0, x+1);
}
x--;
}
} | 2 |
String getSQLWhere() {
switch (relationship) {
case NOT_EQUALS: return columnName + " <> ?";
case GREATER_THAN: return columnName + " > ?";
case GREATER_THAN_OR_EQUALS: return columnName + " >= ?";
case LESS_THAN: return columnName + " < ?";
case ... | 6 |
public Packet read() {
try {
ByteBuffer header = ByteBuffer.allocate(4);
int code = socket.read(header);
if (code == 4) {
header.flip();
short id = header.getShort();
short len = header.getShort();
ByteBuffer data = ByteBuffer.allocate(len);
socket.read(data);
data.flip();
Packet ... | 5 |
public static boolean testCollectionofMemberOfP(Stella_Object member, Surrogate type) {
{ Object old$ReversepolarityP$000 = Logic.$REVERSEPOLARITYp$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setBooleanSpecial(Logic.$REVERSEPOLARITYp$, false);
Native.setSpecial... | 7 |
public String get_field( String section, String field )
throws NoSuchKeyException, NoSuchSectionException {
Hashtable s;
String t;
if(section==null) {
throw new NoSuchSectionException();
}
if(field==null) {
throw new NoSuchKeyException();
}
s = (Hashtable) sections.get(section);
if( s == null) {
thr... | 4 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Rectangular that = (Rectangular) o;
if (length != that.length) return false;
return width == that.width;
} | 4 |
public float [] compute(float [] x)
{
if (x.length != n)
throw new IllegalArgumentException("BIJfft not properly initialized");
float[] xre = new float[n];
float[] xim = new float[n];
for (int i = 0; i < n; i++)
... | 8 |
protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
int b,c;
int[][] lookup = CHAR_TO_BYTE; // getfield bytecode optimization
int[] table;
int remaining = in.remaining();
while (remaining-- > 0) {
if (out.remaining() < 1)
... | 4 |
public RoomInfo(String mapName){
if(mapName.equals("Exterior1.tmx")){
upDoorPos = null;
downDoorPos = null;
leftDoorPos = new Vector2(1.25f,4.5f);
rightDoorPos = null;
upBoundry = 15f;
downBoundry = 1f;
leftBoundry = 1f;
... | 3 |
@EventHandler(priority = EventPriority.LOW)
public void onExplosionEvent(final EntityExplodeEvent event) {
Location eventLocation = event.getLocation();
if (plugin.Blast_Mode.containsKey(eventLocation)) {
Integer BlastMode = plugin.Blast_Mode.get(eventLocation);
if (BlastMode == 0) {
... | 8 |
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 |
Point3 getVelocityTo(Obstacle o) {
Point3 velocity = o.getPosition().minus(myBeing.getPosition());
velocity.normalize();
return velocity;
} | 0 |
public String getLinkName(Element tcElement){
if (tcElement.getName().equals("transitioncondition")){
Element source = (Element)tcElement.getParentElement();
return source.getAttributeValue("linkName");
}else{
return null;
}
} | 1 |
public void sendFirst() {
System.out.println("-- Alice --");
if (betray) {
System.out.println("ACHTUNG: Betrugsmodus aktiv!!!");
}
// Hard coded messages M_0 and M_1
BigInteger[] M = new BigInteger[2];
M[0] = new BigInteger("11111111111111111111111111111111111111111111111111111111111");
... | 7 |
public List<Turma> pesquisaTurmasDoProfessor(String matriculaProf)
throws ProfessorInexistenteException {
List<Turma> turmasDoProfessor = new ArrayList<Turma>();
boolean flag = false;
for (Professor prof : this.professores) {
if (prof.getMatricula().equals(matriculaProf)) {
turmasDoProfessor = prof.tu... | 3 |
@RequestMapping(value = "del", method = RequestMethod.POST)
@ResponseBody
public Map del(@RequestParam int[] id) {
Map<String, Object> map = new HashMap<>();
List<String> l1 = new ArrayList<>();
List<String> l2 = new ArrayList<>();
List<String> l3 = new ArrayList<>();
f... | 5 |
public Item buildHouseplant(MOB mob, Room room)
{
final Item newItem=CMClass.getItem("GenItem");
newItem.setMaterial(RawMaterial.RESOURCE_GREENS);
switch(CMLib.dice().roll(1,7,0))
{
case 1:
newItem.setName(L("a potted rose"));
newItem.setDisplayText(L("a potted rose is here."));
newItem.setDescripti... | 8 |
private void removeUseless(Grammar g)
{
UselessProductionRemover remover = new UselessProductionRemover();
Grammar g2 = UselessProductionRemover
.getUselessProductionlessGrammar(g);
Production[] p1 = g.getProductions();
Production[] p2 = g2.getProductions();
if (p1.length > p2.length) {
Gra... | 1 |
public static void invokeQuizRemoving(int id) {
for (QuestPoint q : campaign.getQuizes()) {
if (q.getId() == id) {
campaign.removeQuiz(q);
campaign.deleteTrue();
ProjectOptionsView.updateView();
break;
}
}
} | 2 |
private void applyFileHandlers( Environment<String,BasicType> httpConfig )
throws ConfigurationException {
Environment<String,BasicType> httpSettings = httpConfig.getChild( Constants.KEY_HTTPCONFIG_FILEHANDLERS );
if( httpSettings == null ) {
this.getLogger().log( Level.INFO,
getClass().getName() + ".... | 4 |
public static String filter(String str) {
String output = "";
StringBuffer sb = new StringBuffer();
for (int i = 0; i < str.length(); i++) {
int asc = str.charAt(i);
if (asc != 10 && asc != 13) {
sb.append(str.subSequence(i, i + 1));
}
}
output = new String(sb);
return output;
} | 3 |
static Object newObject(String className) {
if (Functions.isEmpty(className)) return null;
Class<?> c;
try {
c = Class.forName(cn(className));
} catch (Throwable e) {
return null;
}
Object returnObject;
try {
returnObject = c.newInstance();
} catch (Throwable e) {
return null;
}
return... | 4 |
public static void main(String[] args) throws SlickException{
//establish game event factory
new ERGameEventFactory();
if(args.length==0){
args = new String[] {"-sc"};
}
if(args[0].equals("-s") || args[0].equals("-sc") ){//run the server on -s command
EmptyRoomServer serve... | 7 |
@Override
protected void paintExpandControl(Graphics g, Rectangle clipBounds, Insets insets,
Rectangle bounds, TreePath path, int row, boolean isExpanded,
boolean hasBeenExpanded, boolean isLeaf) {
// if the given path is selected, ... | 5 |
public PaymentEntity getPayment() {
return payment;
} | 0 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Subgoal subgoal = (Subgoal) o;
if (condition != null ? !condition.equals(subgoal.condition) : subgoal.condition != null) return false;
if (step... | 7 |
int unpack(Buffer opb){
int vendorlen=opb.read(32);
if(vendorlen<0){
clear();
return (-1);
}
vendor=new byte[vendorlen+1];
opb.read(vendor, vendorlen);
comments=opb.read(32);
if(comments<0){
clear();
return (-1);
}
user_comments=new byte[comments+1][];
com... | 5 |
public boolean clicked() {
if(key.isPressed() && !key.isHeld())
return true;
else
return false;
} | 2 |
public void update(int playerScores[]){
for(int i=0;i<playerScores.length;i++){
this.playerTotals[i] = playerScores[i];
this.l_playerTotals[i]
.setText(new Integer(playerScores[i]).toString());
}
p_playerScores.removeAll();
//f... | 9 |
public static Color clipcol(int r, int g, int b, int a) {
if (r < 0)
r = 0;
if (r > 255)
r = 255;
if (g < 0)
g = 0;
if (g > 255)
g = 255;
if (b < 0)
b = 0;
if (b > 255)
b = 255;
if (a < 0)
... | 8 |
private boolean jj_2_16(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_16(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(15, xla); }
} | 1 |
private void checkFolder() {
File KeywordFolder;
boolean stateKeywordFolder;
KeywordFolder = new File("./KeyWord");
stateKeywordFolder = KeywordFolder.exists();
if(stateKeywordFolder == false ){
System.out.println("The 'KeyWord' folder do not exist,trying to create one...");
stateKeywordFolder = Keywo... | 2 |
private String pedirPista() {
if(pistasAgotadas()){
pistasUsadas++;
return diccionario.getPistaPalabraEspecifica(palabraActualObjeto)+"\n";
}
else{
return "Se agoto el numero de pistas";
}
} | 1 |
private synchronized void unchokePeers(boolean optimistic) {
// Build a set of all connected peers, we don't care about peers we're
// not connected to.
TreeSet<SharingPeer> bound = new TreeSet<SharingPeer>(
this.getPeerRateComparator());
bound.addAll(this.connected.values());
if (bound.size() == 0) {
... | 9 |
public static void main(String[] args) throws KeyStoreException {
PlayerRepository<Schema.Player> repository = JacksonPlayerRepository.create("/master.player.json");
Iterable<? extends Player> players = Iterables.transform(repository.getPlayers(),Schema.TRANSFORM);
players = Iterables.filter(p... | 3 |
public void compile(String directory, String fileName) {
fileName = FileUtil.quoteFileName(fileName);
ConsoleDialog console;
if (editor != null) {
console = new ConsoleDialog(editor, "Compiling", false);
} else {
console = new ConsoleDialog();
}
console.setSize(500, 400);
console.setText("Compilin... | 8 |
public void processEvent(Event event)
{
if (event.getType() == Event.COMPLETION_EVENT)
{
System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle());
return;
}
System.out.println(_className + ".processEvent: Received Login Response..... | 8 |
public Node mergeNodes(Node node1, Node node2) {
Node superNode = new Node(node1.getId() + "-" + node2.getId());
addNode(superNode);
List<Node> connectedNodes = new ArrayList<Node>();
for (Node node : getAdjacentNodes(node1)) {
if (!node.equals(node1) && !node.equals(node2)) {
connectedNodes.add(node);
... | 8 |
public static List<Apple> filterGreenApples(List<Apple> inventory) {
List<Apple> filteredApples = new ArrayList<>();
for (Apple apple : inventory) {
if(Apple.AppleColor.GREEN.equals(apple.getColor())) {
filteredApples.add(apple);
}
}
return filtere... | 2 |
public void check() {
if (chrlist == null)
return;
if (selbtn == null)
return;
if (chr == null) {
chr = chrlist.opts.get(0).name;
} else {
String nm = null;
for (Listbox.Option opt : chrlist.opts) {
if (opt.disp... | 6 |
@Test
public void parseTestInfo() {
String str = Utils.getFileContents(TEST_INFO);
JSONObject testInfoJO = null;
TestInfo ti_actual = new TestInfo();
TestInfo ti_expected = new TestInfo();
ti_expected.setId("411711");
ti_expected.setName("load_test");
ti_expec... | 1 |
public void createClient() {
Socket socket;
BufferedReader in;
PrintWriter out;
try {
socket = new Socket(InetAddress.getLocalHost(),5000);
System.out.println("Demande de connexion ...");
BufferedWriter w = new ... | 2 |
public boolean isTile(int x, int y)
{
return (x >= 0 && x < sea.length && y >= 0 && y < sea[0].length);
} | 3 |
@Override
public boolean isElementContentWhitespace() {
final String nodeValue = this.getNodeValue();
for (int i = 0, size = nodeValue.length(); i < size; i++) {
final char value = nodeValue.charAt(i);
if ((value > 0x20) || (value < 0x09)) return false;
if ((value != 0x0A) && (value != 0x0D)) return... | 5 |
public NewAd() {
setSize(new Dimension(620, 620));
setResizable(false);
setTitle("Edit Ad");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(200, 200, 620, 620);
setIconImage(Toolkit.getDefaultToolkit().getImage("ICON2_Scaled.png"));
contentPane = new JPanel();
contentPane.setBorder(new Lin... | 8 |
private Collection<String> loadPrimaryColumns(String tableName) {
LinkedList<String> returnValue = new LinkedList<String>();
ResultSet rs = null;
try {
DatabaseMetaData metadata = connection.getMetaData();
SQLDatatbaseType sqlDatatbaseType = SQLDatatbaseType.getType(metadata.getURL());
/**... | 9 |
private void load() {
long startTime = System.currentTimeMillis();
logger.info("Starting reload of soft state...");
// the next version of the soft state
final Map<KeyRegistrationRecord, Set<KeyRegistrationRecord>> topology = new ConcurrentHashMap<KeyRegistrationRecord, Set<KeyRegistrationRecord>>();
fi... | 5 |
public EditorPane(RegularExpression expression) {
// super(new BorderLayout());
this.expression = expression;
field.setText(expression.asString());
field.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
updateExpression();
}
});
field.getDocument().addDocum... | 0 |
public static void main(String[] args) {
Client client = null;
try {
Socket socket = new Socket(host, port);
client = new Client(socket);
} catch (UnknownHostException ex) {
System.out.println("Don't know about server " + host + ":" + port);
... | 7 |
private int c2I(char c) {
int x = 0;
switch (c) {
case 'A': x = 0;
break;
case 'C': x = 1;
break;
case 'G': x = 2;
break;
case 'T': x = 3;
break;
default: x... | 4 |
public Perlin(int width, int height) {
random = new int[512];
Random r = new Random();
for (int i=0;i<512;i++) {
random[i] = r.nextInt(256);
}
data = new int[width][height];
for (int i=0;i<width;i++) {
for (int j=0;j<height;j++) {
... | 7 |
public boolean Salvar(FormasPagamento obj){
PreparedStatement comando;
try{
if(obj.getId() == 0){
comando = banco.getConexao()
.prepareStatement("INSERT INTO tipos_pagamento "
+ "(nome,ativo) VALUES (?,?)");
coma... | 2 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
HttpSession mensaje = request.getSession(true);
ResultSet respuesta=null;
PrintWriter out = response.getWriter();
... | 5 |
public void updateStates() {
for (Player p : players) {
if (p != null && !p.dead) {
p.update();
}
}
for (Attack a : attacks) {
if (a != null) {
a.update();
int y = a.getLoc().getY();
int x = a.getLoc().getX();
if (y < 0 || y > StartUp.height || x < 0 || x > StartUp.width) {
atta... | 9 |
public void addNeuron(ArrayList<Connection> connects,Neuron neuron){
// THIS SHOULD NEVER RUN
if(connects.isEmpty()){
mutate();
return;
}
int connectionNum=rng.getInt(connects.size(),null,false);
Connection connection=connects.get(connectionNum);
/... | 6 |
public void jugarAjedrez(){
iniciarElTablero();
imprimirArreglo();
int aband;
setTurno1();
do {
try{
System.out.println("Es el turno del jugador "+getTurno());
System.out.print("Ingrese la Fila: ");
f... | 7 |
public JSONObject toJson() {
JSONObject rtn = new JSONObject();
try
{
rtn.put("type", this.getClass().getSimpleName());
rtn.put("value", this.getValueForOutput());
} catch (JSONException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return rtn;
} | 1 |
public Profile getProfile(String asAttendeeNumber) {
if (asAttendeeNumber == null || asAttendeeNumber.trim().length() == 0) {
throw new IllegalArgumentException("attendee num parameter is null");
}
return get(Profile.class, REST_URL_PROFILE + encode(asAttendeeNumber));
} | 2 |
public void onStop() throws JFException {
} | 0 |
public String getDescription() {
if(description==null)
return super.toString();
return description;
} | 1 |
public void setUnblocked(Account account){ account.setUnblocked(); } | 0 |
public ArrayList<Team> getAllTeams(Connection con) {
ArrayList<Team> arrayTeams = new ArrayList();
String SQLString = "SELECT * "
+ "FROM Teams ";
PreparedStatement statment = null;
try {
statment = con.prepareStatement(SQLString);
ResultSet rs... | 3 |
public static IntersectData colliders( Collider collider1, Collider collider2 )
{
if ( collider1 == null || collider2 == null )
return null;
if ( collider1.getType() == ColliderType.SPHERE && collider2.getType() == ColliderType.SPHERE )
return ( (SphereCollider) collider1 ).intersect( (SphereCollider) collid... | 8 |
public void drawMap(Graphics graphics){
if (this.background != null){
graphics.drawImage(background, this.position.x, this.position.y, null);
}
if ((grid != null) && (showGrid)){
grid.paintComponent(graphics);
}
if (showGridEditor... | 7 |
private Resource parseText(String lineOfText) {
boolean done = false; // Indicates the end of parsing
String token; // String token parsed from the line of text
int tokenCount = 0; // Number of tokens parsed
int frontIndex = 0; // Front index or character position
int backIndex = 0; // Rear index or characte... | 9 |
public Image getImage(final double W, final double H) {
final int WIDTH = (int) W;
final int HEIGHT = (int) H;
WritableImage DESTINATION = new WritableImage(WIDTH, HEIGHT);
final int[] IN_PIXELS = new int[WIDTH];
final int[] OUT_PIXELS = new int[WIDTH];
randomNumbers... | 5 |
public void setQty(int newQty) {
qty = newQty;
if (qty < 1) {
itemType = null;
qty = 0;
}
} | 1 |
@Override
public void run() {
long last = System.currentTimeMillis();
while (running) {
long now = System.currentTimeMillis();
long delta = now - last;
update(delta);
render();
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
last = now;
}
} | 2 |
public JSONObject increment(String key) throws JSONException {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
} else if (value instanceof Integer) {
this.put(key, ((Integer) value).intValue() + 1);
} else if (value instanceof Long) {
... | 5 |
public void adjustSize(int width, int height) {
saving = true;
if(width > bi.getWidth() || height > bi.getHeight()) {
BufferedImage tempBi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = tempBi.createGraphics();
this.paint(g);
g.dispose();
bi = tempBi;
} else {
Buffe... | 2 |
@Override
protected void createReaderWriter() throws JoeException {
ourReaderWriter = new PdbTMReaderWriter() ;
if (ourReaderWriter == null) {
throw new JoeException(UNABLE_TO_CREATE_OBJECT) ;
}
} | 1 |
private Set<Card> FourFlushWithWheelStraight() {
return convertToCardSet("JD,4S,8S,3S,5S,AC,2H");
} | 0 |
public void dispatchEvent(Event event) {
if (!listeners.containsKey(event.getClass())) return;
Class<? extends Event> clazz = event.getClass();
while (clazz != null) {
for (Listener listener : listeners.get(event.getClass())) {
listener.onEvent(event);
}
... | 5 |
public int getInt(String o) {
String i = ", ";
if (o.equals("avatarid"))
i = "}";
String v = Pattern.compile(o + ": ").split(line)[1];
return Integer.parseInt(v.substring(0, v.indexOf(i)));
} | 1 |
public void addCarriage(RollingStock newCarriage) throws TrainException {
if (train.isEmpty()) {
if (newCarriage instanceof Locomotive) {
train.add(newCarriage);
} else {
throw new TrainException(
"Invalid train configuration: Locomotive must be the first carriage.");
}
} else if (passenge... | 7 |
public static void main(String [] args) {
int[] d;
d = new int[10001]; // we'll ignore d[0];
for (int i = 1; i<10001; i++) {
// compute d(i)
int divisorSum = 0 ;
for (int j = 1; j<=1 + i/2; j++) {
if (i%j == 0) {
divisorSum += j;
}
}
d[i]=divisorSum;
}
int amicableSum = 0;
for ... | 8 |
private void rapatrierFormations() {
ArrayList<Formation> formations = new ArrayList<Formation>();
String req = "";
req = "select * from Formation";
ResultSet res = null;
try {
res = gestionUniversite.Connexion.getInstance().getStatement().executeQuery(req);
... | 5 |
private void initialize()
{
setForeground(Color.white);
setOpaque(false);
setContentAreaFilled(false);
setBorderPainted(false);
if (name != null)
{
this.setText(name);
this.setToolTipText(name);
}
setVerticalTextPosition(SwingConstants.BOTTOM);
setHorizontalTextPositi... | 3 |
public RegularGrammar getRegularGrammar() {
return (RegularGrammar) getGrammar(RegularGrammar.class);
} | 0 |
@Override
public void keyPressed(KeyEvent e) {
int keys = e.getKeyCode();
if (keys == KeyEvent.VK_ESCAPE) {
mainMenuObj.setMx(WINDOW_WIDTH);
currentMode = mode1;
ticTacToeFunctionsObj.clearPlayerScores(ticTacToePlayerObj);
for (int i = 0; i < 10; i++... | 5 |
public String getBestScore() {
String res = "";
Collections.sort(scores);
res = scores.get(scores.size()-1);
return res;
} | 0 |
public Copyable getVersion(Transaction me, ContentionManager manager) {
while (true) {
if (me != null && me.getStatus() == Status.ABORTED) {
throw new AbortedException();
}
switch (writer.getStatus()) {
case ACTIVE:
if (manager == null) {
throw new PanicExcept... | 7 |
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.