text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void divideLargeFile(final String filePath) throws IOException {
int fileIndex = 0;
File extractFile = new File("E://WDMRDB//Wiki//2009-11-5_LeavesNode_" + fileIndex + ".txt");
FileWriter extractFileWriter = new FileWriter(extractFile);
int count=0;
for(String tmp : leavesSet){
count++;
ex... | 2 |
public String convertHarga(int harga){ // jadi tar kalo 50000 jadi 50.000 dst...
// harga = 444;
int ribuan[] = new int[10];
int counter=0;
String temphasil="";
while(harga/1000!=0){
ribuan[counter] = harga%1000;
counter++;
//temphasil = temphasil + ribuan+".";
harga = harga /1000... | 9 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SiteBoundaryAttribute)) {
return false;
}
SiteBoundaryAttribute other = (SiteBoundaryAttribute) object;
if ((th... | 5 |
private void setBackgroundColor(int i) {
if (atom == null)
return;
String s = ((AtomisticView) atom.getHostModel().getView()).getColorCoding();
if ("Lego".equals(s)) {
if (AMINO_ACID[i].getCharge() > 0) {
mi[i].setBackground(new Color(ColorManager.LEGO_BASIC_COLOR));
}
else if (AMINO_ACID[i].getCh... | 8 |
public static String getBinaryFloat (float f) {
assert ( 0.0 < f && f < 1.0) : " f in (0.0, 1.0)";
StringBuffer sb = new StringBuffer();
sb.append("0.");
f = f*2;
while ( f > 0 ) {
if ( sb.length() > 32 ) {
return "ERROR";
}
if ( f >= 1) {
sb.append( 1 );
f = ( f - 1 ) * 2;
} else i... | 5 |
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, IsDeleted__typeInfo)) {
... | 9 |
* @param settlement The <code>Settlement</code> that is trading.
*/
private void attemptSellToSettlement(Unit unit, Settlement settlement) {
Goods goods = null;
for (;;) {
// Choose goods to sell
goods = gui.showSimpleChoiceDialog(unit.getTile(),
"sellPro... | 9 |
public Console() {
for(int i = 0; i < COUNT_OF_COMMANDS; i++) {
switch (i) {
case 0: {
COMMANDS_DESCRIPTION[i] = START_GAME_WITH_COMPUTER_COMMAND + " - start game with computer";
break;
}
case 1: {
... | 6 |
private void setHeuristicValue()
{
if(this.map == null || this.heuristic == null)
return;
for(int i = 0; i < this.map.columnsCount(); i++)
{
for(int j = 0; j < this.map.rowsCount(); j++)
{
this.map.getState(i, j).setH(this.heuristic.getHeuricticValue(i, j,
this.map.getGoalState().getX(), th... | 4 |
@Test
public void esteKuuluukoPiste() {
assertTrue("Vasen yläkulma pieleen", e.kuuluukoPiste(p) != null);
p.siirra(10, 0);
assertTrue("Oikea yläkulma pieleen", e.kuuluukoPiste(p) != null);
p.siirra(0, 10);
assertTrue("Oikea alakulma pieleen", e.kuuluukoPiste(p) != null);
... | 0 |
@Override
public Map<String, String> getParsedResults() {
if (!resultingMap.isEmpty()) {
return resultingMap;
}
String[] lines = stringBuilder.toString().split("\n");
for (String line : lines) {
line = line.trim();
if (line.startsWith("活动时间:")) {
parseStartAndEndTime(line.substring("活动时间:".length(... | 4 |
private void diffOffering(CourseRec oldRec, OffRec oldOff,
HashMap<String, Object> newOff, ArrayList<Change> changes) {
// Start date.
Date newDate = getStartDate(newOff);
if (oldOff.getStart() == null && newDate != null
|| oldOff.getStart() != null
&& !oldOff.getStart().equals(newDate)) {
changes.a... | 6 |
public void send_TCP_packet(Packet app_pack) throws InterruptedException
{
//faz 3-way-handshake
if (!open_connection(app_pack))
return;
//constrói pacote TCP
Packet packet = build_TCP_packet(app_pack);
if (packet == null)
return;
int ACK = (int)Math.round(Math.random()*1000) + 2; //numero entre ... | 6 |
public Juoma haeJuoma(int id) throws DAOPoikkeus {
// luodaan olio johon juoman tiedot tallennetaan
Juoma juoma = new Juoma();
// haetaan hörpyn tiedot tietokannasta
try {
JuomaDAO jDao = new JuomaDAO();
juoma = jDao.haeJuoma(id);
} catch (DAOPoikkeus e) {
throw new DAOPoikkeus("Juoman hakemine... | 1 |
public static boolean canPlayerToggleToChannel( BSPlayer p, Channel channel ) {
if ( channel.isDefault() ) {
if ( p.getServerData().forcingChannel() ) {
String forcedChannel = p.getServerData().getForcedChannel();
if ( channel.getName().equals( forcedChannel ) ) {
... | 3 |
@Override
public String toString()
{
final int height = board.length;
final int width = board[ 0 ].length;
final StringBuilder sb = new StringBuilder( height * (width + 1) );
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
if ( !traversable[y][x] )
{
sb.append(' ')... | 4 |
void print(Node t, int n, boolean p)
{
if (p)
{
printCond(t, n);
}
else
{
if (n > 0)
{
for (int i = 0; i < n; i++)
System.out.print(" ");
}
System.out.println("(cond ");
}... | 3 |
public boolean isSyncCurrentPosition(int syncmode) throws BitstreamException
{
int read = readBytes(syncbuf, 0, 4);
int headerstring = ((syncbuf[0] << 24) & 0xFF000000) | ((syncbuf[1] << 16) & 0x00FF0000) | ((syncbuf[2] << 8) & 0x0000FF00) | ((syncbuf[3] << 0) & 0x000000FF);
try
{
source.unread(syncbuf, 0,... | 3 |
void verifikasiBtnHapus(){
if(textSaldoA.getText().isEmpty() && textSaldoB.getText().isEmpty() && textOmset.getText().isEmpty()){
buttonHapus.setEnabled(false);
}
if(textSaldoA.getText().isEmpty() || textSaldoB.getText().isEmpty() || textOmset.getText().isEmpty()){
... | 6 |
public final void metodos() throws RecognitionException {
try {
// fontes/g/CanecaSemantico.g:236:2: ( ^( METODOS_ ( metodo )* ) )
// fontes/g/CanecaSemantico.g:236:4: ^( METODOS_ ( metodo )* )
{
match(input,METODOS_,FOLLOW_METODOS__in_metodos726); if (state.faile... | 9 |
public static AbstractFactory getFactory(int factoryTag) {
switch(factoryTag) {
case 1: return new ConcreteFactory1();
case 2: return new ConcreteFactory2();
}
return null;
} | 2 |
public void mouseMoved(MouseEvent event) {
adapter.mouseMoved(event);
} | 0 |
public Credentials(String loc) throws IOException {
try {
stream = new FileInputStream(loc);
reader = new BufferedReader(new InputStreamReader(stream,
Charset.forName("UTF-8")));
} catch (FileNotFoundException e) {
System.out.println("File does not exist.");
return;
}
String[] lns = new Stri... | 6 |
public Effect(final String name, final int duration, final int delay) {
if (name == null) {
this.theName = "";
}
else {
this.theName = name;
}
if (duration < 0 && duration != Effect.PERMANENT_DURATION) {
this.theDuration = 0;
}
else {
this.theDuration = duration;
}
if (delay < 0) {
this... | 4 |
public static void main(String[] args){
ArrayList<Long> primes = new ArrayList<Long>();
long f = 600851475143L;
long i = 0;
do {
i = factorOf(f);
if(f % i == 0 && !primes.contains(i)){
primes.add(i);
f = f / i;
}
} while(i != f);
primes.add(f);
long largest = 0;
for(long p : primes){... | 5 |
@Override
public void menu() {
out.println();
out.println("[1] Buscar");
out.println("[2] Cadastrar");
out.println("[3] Listar Todos");
out.println("[0] Sair");
switch(sc.nextInt()){
case 1: buscarPacientes(); break;
case 2: cadastraPaciente(); break;
case 3: mostraPacienteLista(); break;
cas... | 4 |
public static int readIntValue() {
boolean isCorrectValue = false;
Scanner console = new Scanner(System.in);
int readValue = 0;
do {
if (console.hasNextInt()) {
readValue = console.nextInt();
isCorrectValue = true;
} else {
... | 2 |
public boolean checkIntegrity() {
boolean ok = true;
for (AIObject ao : aiObjects.values()) {
if (!ao.checkIntegrity()) {
logger.warning("Invalid AIObject: " + ao.getId()
+ " (" + ao.getClass() + ")");
ok = false;
}
}
... | 8 |
@Override
public void actionPerformed(ActionEvent e) {
JButton button = (JButton)e.getSource();
String key = button.getText();
Boolean command = StringUtils.indexOf("0123456789.",key) < 0;
if(!command){
if((number + key).matches("[0-9]*|[0-9]+.[0-... | 9 |
public scoreboard() throws IOException{
super("A Hole in the Universe");
setSize(950,650);
setLocationRelativeTo(null);
//retrieves all player info
//format: "GET_PLAYER_INFO username character ready score comets deaths powerups max_spin max_vel"
allPlayerInfoP1 = Client.sendMsg(msg);
... | 6 |
public void run() {
try {
ObjectOutputStream outStream = new ObjectOutputStream(
new BufferedOutputStream(clientSocket.getOutputStream()));
//Game game = Game.getInstance();
while (true) {
Data data = dataQueue.take();
... | 2 |
public List<City> getCities() {
List<City> list = new ArrayList<>();
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABAS... | 5 |
public void putAll( Map<? extends K, ? extends Long> map ) {
Iterator<? extends Entry<? extends K,? extends Long>> it = map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends K,? extends Long> e = it.next();
this.put( e.getKey(), e.getValue() );
... | 8 |
private void flushAndCloseOutputStream(OutputStream stream) {
if (stream == null) {
return;
}
try {
stream.flush();
} catch (IOException ex) {
System.out.println(ex);
}
closeStream(stream);
} | 2 |
public boolean isValid(int x, int y)
{
//determines whether a particular location is a valid location to put someone/something
if(x > -1 && x < width && y > -1 && y < height)
{
if(theMap[x][y].getType() != 0)
{
return false;
}
else
{
return true;
}
}
return false;
} | 5 |
private void writeObject(ObjectOutputStream out) throws IOException {
purgeThread.interrupt();
processQueue();
HashMap<Object, Object> wcache = new HashMap<Object, Object>();
Iterator<String> it = map.keySet().iterator();
Object key = null;
Object value = null;
while(it.hasNext()) {
key = it.next(... | 5 |
public boolean neljaSamaa(){
for(int i=0; i<2; i++){
if(nopat[i].getValue()==nopat[i+3].getValue()){
return true;
}
}
return false;
} | 2 |
public boolean checkifHasOwner(String uuid){
ArrayList<String> allAnimals = new ArrayList<String>();
if(!plugin.getAnimalData().contains("Farmer")){
return false;
}else{
Set<String> farmers = plugin.getAnimalData().getConfigurationSection("Farmer").getKeys(false);
//getting the farmers animals
for(String ... | 5 |
public String[] whichPages(String word) {
word = word.toLowerCase();
ArrayList<String> pages = new ArrayList<String>();
for(Term term: termIndex){
if (term.getName().equals(word)){
for(Occurrence occ: term.getDocsList()){
pages.add(occ.getDocName()... | 3 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
String line = "";
while ((line = in.readLine()) != null && line.length() != 0) {
int[] v = readInts(line.trim());
if (v[0] == 0 && ... | 8 |
public static String createWhoIsOnlineMessage(String myName) {
JSONObject jsonMsg = new JSONObject()
.element( "code", "1" )
.element( "name", myName )
;
return jsonMsg.toString();
} | 0 |
private void makeInputItems() {
boolean first = true;
for (Connector c : element.getConnectors()) {
if (c instanceof InputConnector) {
InputConnector ic = (InputConnector) c;
if (ic.isConnected()) {
if (first) {
first = false;
add(new JPopupMenu.Separator());
}
ComponentMenuIte... | 4 |
public int findIndex(char ch)
{
if(Character.getNumericValue(ch)==1) {return 0;}
if(Character.getNumericValue(ch)==2) {return 1;}
if(Character.getNumericValue(ch)==3) {return 2;}
if(Character.getNumericValue(ch)==4) {return 3;}
if(Character.getNumericValue(ch)==5) {return 4;}
if(Character.getNume... | 8 |
private boolean check(FlowNetwork G, int s, int t) {
// check that flow is feasible
if (!isFeasible(G, s, t)) {
System.err.println("Flow is infeasible");
return false;
}
// check that s is on the source side of min cut and that t is not on source side
if... | 9 |
public static void testFillTable() throws DatabaseException {
Connection conn = null;
ResultSet rs = null;
PreparedStatement ps = null;
Random randomGenerator = new Random();
int uid, i;
String q = "INSERT INTO test(uid,bid,auctionID) VALUES(?,1,17)";
try {
conn = DBPool.getInstance().getConnection()... | 8 |
public void load(String pedFileName) {
String pedBaseFileName = Gpr.removeExt(pedFileName);
String mapFile = pedBaseFileName + ".map";
PedFileIterator pedFile = new PedFileIterator(pedFileName, mapFile);
// Load all entries for this family
int count = 1;
for (PedEntry pe : pedFile) {
if (verbose) Gpr.s... | 2 |
protected Value runBlock(Block body, CodeBlock i) throws InterpreterException{
Block b = body;
Value last = null;
while (b != null && !__end && !__return) {
last = b.run(i);
if (b instanceof ReturnBlock) {
__return = true;
System.out.println("RETURN!");
} else
b = b.next();
}
return last;... | 4 |
public int getWarnings(Account account){ return account.getWarnings(); } | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
Physical target=mob;
if((auto)&&(givenTarget!=null))
target=givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",... | 7 |
public boolean initialize() {
CommPortIdentifier portID = null;
Enumeration ports = CommPortIdentifier.getPortIdentifiers();
System.out.println("Trying ports:");
while(portID == null && ports.hasMoreElements()) {
CommPortIdentifier testPort = (CommPortIdentifier) ports.nextElement();
System.out.println("... | 7 |
void doMovement(){
if(hitsObstacle(me())){
dead=true;
}
double currentSpeed=walkSpeed;
if(Display.left)xVel-=currentSpeed;
if(Display.right)xVel+=currentSpeed;
if(hitsObstacle(me(0,1))){
if(Display.up)yVel-=jumpHeight;
}else{
yVel+=2;
}
xVel*=walkDelay;
yVel*=gravity;
double uvx = xVel/... | 8 |
public int compare(Object arg1, Object arg2)
{
Segment A = (Segment) arg1;
Segment B = (Segment) arg2;
Point Agauche = (A.a.x > A.b.x) ? A.b : A.a;
Point Adroite = (A.a.x > A.b.x) ? A.a : A.b;
Point Bgauche = (B.a.x > B.b.x) ? B.b : B.a;
Point Bdroite = (B.a.x > B.b.x) ? B.a : B.b;
if (Agauche.... | 8 |
private static String dozensContains( Map recordMap, String host, String ip )
{
if( !recordMap.containsKey( "record" ) )
{
return null;
}
List recordList = ( List )recordMap.get( "record" );
for( int i = 0; i < recordList.size(); ++i )
{
Map record = ( Map )recordList.get( i );
if( record.containsKey( "type" ) &... | 8 |
private void addHour(List<QlockWord> timeList, final int HOUR) {
if (HOUR == 12) {
timeList.add(QlockLanguage.EINS);
} else {
if (HOUR + 1 == 5) {
timeList.add(QlockLanguage.FÜNF2);
} else if (HOUR + 1 == 10) {
timeList.add(QlockLanguag... | 4 |
public boolean suorita(String s) {
this.s = s;
ArrayList<String> edelliset = new ArrayList<String>();
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (grid[i][j].equals(Character.toString(s.charAt(0)))) {
//tN = tarkistaNaapurit
... | 4 |
public static void main(String[] arg) {
//this program determines whether user inputted horizontal and vertical line intersect in the x-y plane
double Hy, Hxl, Hxr, Vx, Vyt, Vyb;
boolean validVertical = false;
Scanner input = new Scanner(System.in);
for (;;){
System.out.print("Please enter the... | 7 |
public boolean checkBox(int row, int col)
{
int i = 0, j = 0, k = 0, count = 0;
for(k = 1; k < 10; k++)
{
for(i = row; i < row+3; i++)
{
for(j = col; j < col+3; j++)
{
count = 0;
if(k == Integer.parseInt(entries[i][j].getText()) )
{
count++;
}
if(count >= ... | 5 |
public void discover() {
InetAddress pingAddr;
System.out.println("Attempting to resolve gateway...");
try {
pingAddr = InetAddress.getByName("www.google.com");
this.ARPListener.setFilter("tcp and dst host "+pingAddr.getHostAddress(),true);
this.ARPListener.getListener().setPacketReadTimeout(5000);
th... | 9 |
@Override
public boolean sendDeath() {
WorldTasksManager.schedule(new WorldTask() {
int loop;
@Override
public void run() {
if (loop == 0) {
player.setNextAnimation(new Animation(836));
} else if (loop == 1) {
player.getPackets().sendGameMessage(
"Oh dear, you have died.");
} e... | 9 |
@Test
public void shouldThrowErrorWhenBoardDimensionsWrong() throws IOException {
//given
File tmpFile = folder.newFile(FILENAME);
FileOutputStream fileOutputStream = new FileOutputStream(tmpFile, true);
CharsetEncoder charsetEncoder = Charset.forName(ENCODING).newEncoder();
... | 1 |
void simple2 (){
int counter = 0;
for (int i = 3; ; i++) {
for (int j = 2; j < i; j++) {
if (i % j != 0) {
if (j == i - 1) {
counter += 1;
System.out.print(i + " ");
}
} el... | 5 |
public static boolean placeRailAt(ItemStack stack, World world, int i, int j, int k) {
if (stack == null)
return false;
if (stack.getItem() instanceof ITrackItem)
return ((ITrackItem) stack.getItem()).placeTrack(stack.copy(), world, i, j, k);
if (stack.getItem() instanceo... | 5 |
public static void majority(Integer[] v) {
int median = getNthValue(v, 0, v.length - 1, v.length / 2);
int majorityCount = 0;
for (Integer value : v) {
if(value == median) majorityCount++;
}
if(majorityCount > v.length / 2) {
System.out.println(median);
... | 3 |
public String createEdgeLabel(String vertex1, String vertex2) {
if(vertex1.substring(1).equals(vertex2.substring(0, vertex2.length()-1))){
String suffix="";
if(containsEdge(findEdge(vertex1,vertex2))){
Collection<String> fromV1 = getOutEdges(vertex1);
Collection<String> intoV2 = getInEdges(vertex2);
... | 5 |
public boolean getSelectionOnly() {
return this.selectionOnly;
} | 0 |
private BufferedImage chooseImage(String title, String text,
boolean sameSize) {
List<String> imagens = getImageNames(sameSize);
imagens.remove(getSelectedFrame().getTitle());
if (imagens.size() == 0)
return null;
String imgName = (Stri... | 5 |
private CommucObj handleDoResEntropySlave(CommucObj cObj){
//TODO: understand what this function does and fix it for multiple strands
long startTime = System.currentTimeMillis();
//Set nonprotein strands as not present
for(int i=0; i<cObj.strandPresent.length;i++){
boolean isProtein = (new Boolean((String)c... | 9 |
public core.render.Texture getTexture(String resourceName,
int target,
int dstPixelFormat,
int minFilter,
int magFilter) throws IOException
{
int srcPixelFormat = 0;
... | 2 |
public static RunPhylipOutput consenseRootedTrees(String query, String consensusType)
{
GetAbsolutePath pt = new GetAbsolutePath();
String absolutePath = pt.getPath();
Runtime rt = Runtime.getRuntime();
String output = "";
String status = "Job Successfully Submitted"... | 7 |
public NewItemDialog(JFrame frame) {
super(frame, true);
this.setTitle("Add new item to library");
this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(240, 230));
jcbType = new JComboBox<Item.ItemType>();
for (Item.ItemType type : Item.ItemType.values())
jcbType.addItem(type);
... | 4 |
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 static void stop() {
if (task != null && !task.isDone()) {
task.cancel(true);
task = null;
BmLog.info("TestListController is stopped");
}
} | 2 |
public static void main(String[] args) {
System.out.print("Podaj tytul pierwszego utworu: ");
String tytulPiosenki1 = IO.readString();
System.out.print("Podaj czas trwania pierwszego utworu (minuty): ");
int pierwszyUtworMinuty = IO.readInt();
System.out.print("Podaj czas trwani... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
State other = (State) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fals... | 6 |
public GregorianCalendar getFechaEncargo() {
return fechaEncargo;
} | 0 |
static public int get(int itemLevel, QualityT quality, ArmorT armor, EquipT equip) {
if (armor.armorTotalIndex < 0) {
if (armor == ArmorT.SHIELD) {
if (itemLevel < 1 && itemLevel > Shield.data.length) {
throw new IllegalArgumentException("Invalid Item Leve... | 6 |
public static boolean addEndAndStartOfSequenceAfterThisWord(String currentWord,
String prevWord, SpacingModel nextSpace,int lengthSinceLastBreak) {
//System.out.println("currentWord="+currentWord+" prev="+prevWord+" nextSpace="+nextSpace+" int="+lengthSinceLastBreak);
if (currentWord.equals(ENDER)) {
re... | 7 |
public void SetSmithing(int WriteFrame) {
outStream.createFrameVarSizeWord(53);
outStream.writeWord(WriteFrame);
outStream.writeWord(Item.SmithingItems.length);
for (int i = 0; i < Item.SmithingItems.length; i++) {
Item.SmithingItems[i][0] += 1;
if (Item.SmithingItems[i][1] > 254) {
outStream.writeByt... | 4 |
@Override
public void run()
{
Query currentQuery;
while(!Thread.interrupted())
{
synchronized(queries)
{
try
{
while(queries.isEmpty()) queries.wait();
}
catch(Interrupte... | 5 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Persona other = (Persona) obj;
if (!Objects.equals(this.nombre, other.nombre)) {
return false... | 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://down... | 6 |
@Override
public void run()
{
Path path = new Path();
PathSource pathSource = new PathSourceLink(map);
int sx = player.location.x;
int sy = player.location.y;
int dx, dy;
while(go) {
// Find a random empty spot on the map
do {
... | 5 |
public Queen(boolean isWhite, ImageIcon imgIcon) {
super(isWhite, imgIcon);
this.setIcon();
} | 0 |
private void jButtonSauvegarderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSauvegarderActionPerformed
//Récupération de la méthode contrôleur 'sauvegarderRapport'
ctrlCR.sauvegarderRapport();
}//GEN-LAST:event_jButtonSauvegarderActionPerformed | 0 |
public void write(Size size, int bank, int addr, int val) {
boolean fastrom = false;
// Determine speed by bank
if (bank >= 0x80) {
fastrom = true;
}
if ((bank == 0x00 || bank == 0x80) && addr >= 0x4000 && addr <= 0x41FF) {
Timing.cycle(12); // 12 master cycles to access these
set(size,bank,ad... | 6 |
private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed
if(login(usernameField.getText(),passwordField.getText())){
JOptionPane.showMessageDialog(null, "Logged in as " + account.getUsername());
this.dispose();
}
}/... | 1 |
public WidthChangeHandler(boolean increment) {
this.increment = increment;
} | 0 |
public static Reponse creerReponse(Sujet sujet, String message, Utilisateur utilisateur)
throws ChampInvalideException, ChampVideException {
if (!sujet.peutRepondre(utilisateur))
throw new InterditException("Vous n'avez pas les droits requis pour répondre");
EntityTransaction tr... | 5 |
public boolean eq(Matrix B) {
Matrix A = this;
if (B.M != A.M || B.N != A.N)
throw new RuntimeException("Illegal matrix dimensions.");
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
if (A.data[i][j] != B.data[i][j])
return false;
return true;
} | 5 |
private Formula negotiate(int snum) {
Formula offer = null, prevOffer= null;
int step = 0;
Formula finalOffer = null;
System.out.println("");
System.out.println("************* Negotiation Starts *************");
while (true) {
step++;
//System.out.println("");
System.out.println("Step: " + st... | 6 |
public void visitFieldInsn(final int opcode, final String owner,
final String name, final String desc) {
buf.setLength(0);
buf.append(tab2).append(OPCODES[opcode]).append(' ');
appendDescriptor(INTERNAL_NAME, owner);
buf.append('.').append(name).append(" : ");
appendDescriptor(FIELD_DESCRIPTOR, desc);
bu... | 1 |
public boolean takeDamage(int amount, Living from) {
if (from != null && !from.living()) {
return false;
}
if (amount > 0) {
washurt.add(amount);
}
hp -= amount;
if (hp < 1) {
hp = 0;
dead = true;
return true;
... | 4 |
@Override
public String mover(int fila, int columna, int turno) {
if(this.columna==columna){
if((this.fila>=1&&this.fila<=6)&&(this.fila+1==fila||this.fila-1==fila))
return getPeon(turno);
else if((this.fila==6&&fila==4)||(this.fila==1&&fila==3))
retur... | 9 |
@SuppressWarnings("unchecked")
protected <C extends Component> C get(Entity entity,
Class<? extends Component> componentClass) {
int entityId = entity.getId();
int componentId = getId(componentClass);
Bag<Component> components = componentIdToComponents.get(componentId);
if (components == null) {
throw ne... | 3 |
@Override
public void stateChanged(/*@NotNull*/ ChangeEvent<State> event) {
Util.checkNotNullArgument(event);
if (!isBackground(event)) {
return;
}
if (event.getNewValue() != null) {
State state = event.getNewValue();
int count = getBackgroundTaskCount();
upda... | 9 |
private void stopFileSender() {
while (this.fileSenderThread != null && this.fileSenderThread.isAlive()) {
this.fileSenderThread.interrupt();
try {
this.fileSenderThread.join();
System.out.println("fileSenderThread finish");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} | 3 |
public boolean[][] analyseData() {
// creates a 2D boolean array for each grade and period
boolean[][] checkboxBooleanArray = new boolean[totalGrades][perPerDay];
// for loop cycles through each one and checks to which checkboxes are
// selected and assigns that value to the sepcific position
for (int y = 0... | 6 |
public void carregaMusicas(File[] arquivos,Atualizador atualizador, ArrayList<Tags> listaTags)
throws ListaNulaException, ListaVaziaException {
// declara variaveis
String artista = ConstantesUI.STRING_VAZIA;
String album = ConstantesUI.STRING_VAZIA;
String ano = ConstantesUI.STRING_VAZIA;
String genero =... | 9 |
@Override
public Iterable<? extends Position<T>> children(Position<T> p)
throws InvalidPositionException, BoundaryViolationException {
// focusing on a particular node, return 0, 1 or 2 children
ArrayList<Position<T>> children = new ArrayList<Position<T>>();
if (hasLeft(p))
children.add(left(p));
if (ha... | 3 |
private static void vote(Desc desc) {
List<String> keywords = desc.keywords;
int[] votes = new int[N];
for (BookName bn : booknames) {
for (String kw : keywords) {
if (!ignoredKeywords.contains(kw) && bn.keywordSet.contains(kw)) {
votes[bn.index]... | 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.