text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void run() //listening
{
print("listening port: " + port);
while (true)
{
Socket s;
ObjectInputStream input;
ObjectOutputStream output;
try
{
s = ss.accept();
input = new ObjectInputStream(s.... | 9 |
private void stopListeningToMessages() {
if(ChatClient.messageReciever != null && !ChatClient.messageReciever.isInterrupted()) {
ChatClient.messageReciever.interrupt();
ChatClient.messageReciever.sendUnblockMessageToReciever(); /*
* Sende dem Socket des ClientMessageRecieve... | 3 |
public static void insertArticle(int idCouleur, int idtva, String libelle, String reference, float prixht, int photo) throws SQLException {
String query;
try {
query = "INSERT INTO ARTICLE (ID_COULEUR,ID_TVA,ARTLIBELLE,ARTREF,ARTPRXHT,ARTPHOTO) VALUES (?,?,?,?,?,?) ";
PreparedS... | 1 |
protected void validateProperties() {
if (pre_signed_put_url != null && pre_signed_delete_url != null) {
PreSignedUrlParser parsedPut = new PreSignedUrlParser(pre_signed_put_url);
PreSignedUrlParser parsedDelete = new PreSignedUrlParser(pre_signed_delete_url);
if (!parsedPut.... | 9 |
public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... | 4 |
public static BufferedImage generatePicture(BufferedImage image,
double mean, double variance) {
int w = image.getWidth();
int h = image.getHeight();
// Obraz wynikowy
BufferedImage result = new BufferedImage(w, h,
BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < w; ++x)
for (int y = 0; y < h; ++y)... | 8 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... | 9 |
public void dispose() {
if (catalog != null) {
catalog.dispose(false);
catalog = null;
}
if (library != null) {
library.dispose();
library = null;
}
pTrailer = null;
if (documentSeekableInput != null) {
try {
... | 7 |
public List<Professor> pesquisaProfessorPeloNome(String nome) {
List<Professor> listaNomes = new ArrayList<Professor>();
for (Professor e : professores) {
if (e.getNome().indexOf(nome) != -1) {
listaNomes.add(e);
}
}
return listaNomes;
} | 2 |
public byte[] encrypt(String plainText) {
byte[] text = plainText.getBytes();
int[] intText = byte2int(text);
int i, v0, v1, sum, n;
i = 0;
while (i < intText.length - 1) {
n = numCycles;
v0 = intText[i];
v1 = intText[i + 1];
sum = 0;
for (int ind = 0; ind < n; ind++) {
v0 += (((v1 << 4) ^... | 2 |
public static List<Tva> selectTva() throws SQLException {
String query = null;
List<Tva> tva = new ArrayList<Tva>();
ResultSet resultat;
try {
query = "SELECT * from TVA ";
PreparedStatement pStatement = (PreparedStatement) ConnectionBDD.getInstance().getPreparedS... | 2 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
int t = Integer.parseInt(in.readLine().trim());
for(int tt = 0; tt<t; tt++){
int size = Integer.parseInt(in.readLine().trim());
m =... | 4 |
public boolean existeProdutos(int idProduto) {
this.setProdutos(this.getProdutosDTO().buscaProdutos(idProduto));
//
if (this.getProdutos() != null &&
this.getProdutos().getIdProduto() != null &&
this.getProdutos().getIdProduto() > 0) {
return EXIST_RECORD;
} else {
return NO_EXIST_RECORD... | 3 |
protected void hypothesizeChomsky(GrammarEnvironment env, Grammar g) {
//System.out.println("Chomsky TIME");
CNFConverter converter = null;
try {
converter = new CNFConverter(g);
} catch (IllegalArgumentException e) {
JOptionPane.showMessageDialog(env, e.getMessage(),
"Illegal Grammar", JOptionPan... | 5 |
public void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification) throws MaltChainedException {
super.initialize(flowChartinstance, chartItemSpecification);
for (String key : chartItemSpecification.getChartItemAttributes().keySet()) {
if (key.equals("id")) {
idName = ... | 9 |
public Object get() {
if (!this.isEmpty()) {
return removeFirst();
} else {
System.err.println("You can\'t do that!");
return null;
}
} | 1 |
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
if(!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "You must be a player to do this.");
return true;
}
Player player = (Player) sender;
if(player.hasPer... | 5 |
public double getGroupVelocity(){
if(this.distributedResistance==0.0D && this.distributedConductance==0.0D){
this.generalPhaseVelocity = 1.0D/Math.sqrt(this.distributedInductance * this.distributedCapacitance);
}
else{
double omegaStored = this.omega;
this.ome... | 2 |
public static Image applyMeanMask(Image original, int maskWidth,
int maskHeight) {
if (original == null) {
return null;
}
Image image = original.shallowClone();
for (int x = 0; x < image.getWidth(); x++) {
for (int y = 0; y < image.getHeight(); y++) {
image.setPixel(
x,
y,
RED,
... | 3 |
@Override
public List<SymptomDTO> getAllSymptoms() throws SQLException {
Session session = null;
List<SymptomDTO> symptoms = new ArrayList<SymptomDTO>();
try {
session = HibernateUtil.getSessionFactory().openSession();
symptoms = session.createCriteria(SymptomDTO.clas... | 3 |
public static void main(String[] args) throws Throwable
{
try
{
Options options = new Options();
options.addOption("v", "verbose", false, "Enables verbose compiler output.");
options.addOption("ee", "easterEgg", false, "Enables compiler easter eggs, DO NOT USE!");
CommandLineParser parser = new Basic... | 4 |
public String getName(){
return this.name;
} | 0 |
private static int run_left(char[][] grid, int[][] from, int[][] to, int N, int M, int max) {
for (int i = 1; i < N; i++) {
for (int jhigh = M-1; jhigh > 0; jhigh--) {
if (grid[i][jhigh] == '#' || from[i-1][jhigh] < 0) continue;
int up = from[i-1][jhigh];
... | 8 |
private void setEhtoX(Pelihahmo h, int x){
if (h==h1){
ehtoh1x = x;
} else {
ehtoh2x = x;
}
} | 1 |
private void calculateImageSizes() {
int oldMaxImageWidth = maxImageWidth;
maxImageWidth = 1;
for (Map.Entry<String, ImageRecord> entry : images.entrySet()) {
if (entry.getValue() != null) {
int val = entry.getValue().image.getAsBufferedImage().getWidth(null);
if (val > maxImageWidth) {
maxImageWi... | 9 |
public static String convertIntToServerChar(int piece) {
piece = Math.abs(piece);
switch (piece) {
case 1:
return "P";
case 2:
return "N";
case 3:
return "B";
case 4:
return "R";
case 5:
return "Q";
case 6:
return "K";
default:
return "";
}
} | 6 |
public void mousePressed(MouseEvent arg0) {
if(status == 2) {
status = 3;
image.repaint();
/*(new Thread(new Runnable() {
public void run() {
try {
animateTutorial();
} catch (InterruptedException e) {
e.printStackTrace();
}
startButton.setEnabled(true);
e... | 2 |
public Person createPerson(String givenName, String surname, String genType, String changeMessage, String birthDate, String birthMonth, String birthYear) {
Person createdPerson = new Person();
Gender gender = new Gender();
Attribution attr = new Attribution();
Name name = new Na... | 8 |
private void check(boolean val, Object... debugArguments) {
if (!val) {
throw new RuntimeException("We have a hacker! debugArguments="
+ Arrays.toString(debugArguments));
}
} | 1 |
public SecurityMenuPreview(SkinPropertiesVO skin, JPanel parent) {
if (skin == null) {
IllegalArgumentException iae = new IllegalArgumentException("Wrong parameter!");
throw iae;
}
this.skin = skin;
this.parent = parent;
} | 1 |
public static void main(String[] args) {
Logger logger = Logger.getLogger(MapTest.class);
logger.info("---- Map Starts ----");
looThruMap = new LoopThruMap();
Map<String, Integer> cart =new TreeMap<String, Integer>();
cart.put("ant",3);
cart.put("zebra",4);
cart.put("book",2);
//Get value by spec... | 4 |
private Date deserializeToDate(JsonElement json) {
synchronized (this.enUsFormat) {
try {
return this.enUsFormat.parse(json.getAsString());
}
catch (ParseException localParseException) {
try {
return this.iso8601Format.parse(json.getAsString());
}
catch (P... | 3 |
@Override
public void windowClosing(WindowEvent e) {
if (Obj.principal != null && !Obj.principal.guardado) {
int g = JOptionPane.showConfirmDialog(null,
"¿Quieres guardar antes de salir?");
switch (g) {
case 0:
if (Obj.princip... | 7 |
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 int getNextWalkingDirection() {
if(wQueueReadPtr == wQueueWritePtr)
return -1;
int dir;
do {
dir = Misc.direction(currentX, currentY, walkingQueueX[wQueueReadPtr], walkingQueueY[wQueueReadPtr]);
if(dir == -1) {
wQueueReadPtr = (wQueueReadPtr+1) % walkingQueueSize;
} else if((dir&1) != 0)... | 6 |
public static char[] getOptions(String cmdLineArg) {
char[] result = new char[0];
if (cmdLineArg == null || cmdLineArg.isEmpty()) {
return result;
}
// avoid "--abc"
if (cmdLineArg.lastIndexOf('-') == 0) {
result = cmdLineArg.replace("-", "").toCharArray... | 3 |
public void run() {
boolean check;
check = false;
while (!check) {
// query database access
requestDatabaseInfo();
// create database object
// db = new MySQLClientWrapper(console);
db = new MySQLJDBCConnection(console);
// open database
check = db.open(sqlhostname, sqlport, sqldatabase, s... | 6 |
public Eliminar() {
initComponents();
} | 0 |
public boolean isCorner(){
int countUnblocked=0;
for(int i = 0; i < corridor.length; i++) {
if(corridor[i].getWeight()==1){
countUnblocked++;
}
}
if(countUnblocked == 2) {
if(corridor[0].getWeight() == 1 && corridor[2].getWeight() == 1){
return false;
}
else if(corridor[1].getWeight() == ... | 7 |
public void setBullet(int id, int x, int y){
switch (id) {
case 1:{
this.id = 1;
this.pointX = x;
this.pointY = y;
this.bulletSpeed = 10;
this.shotSpeed = 24;
this.damage = 1;
this.directi... | 3 |
public static QueryIterator createQuerySpecialistIterator(ControlFrame frame, Object [] MV_returnarray) {
{ Proposition proposition = null;
PropertyList subqueryoptions = null;
{ Object [] caller_MV_returnarray = new Object[1];
proposition = ControlFrame.computeSubqueryOptions(frame, caller_MV... | 6 |
public String stemString(String str) {
StringBuffer result = new StringBuffer();
int start = -1;
for (int j = 0; j < str.length(); j++) {
char c = str.charAt(j);
if (Character.isLetterOrDigit(c)) {
if (start == -1) {
start = j;
}
} else if (c == '\'') {
i... | 7 |
private void playerTurn() {
String word="";
//the game loop happens here
while(true){//loop until return
view.messageToPlayer(INPUT_MESSAGE);
word=control.getWord();
if(word.equals("?")){
//special input for help
view.displayHelp();
} else if (word.equals("!")){
//special input for done entering ... | 6 |
public void setRight(PExpLogica node)
{
if(this._right_ != null)
{
this._right_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... | 3 |
@Test(expected=DAIllegalArgumentException.class)
public void evaluatePostfix7() throws DAIndexOutOfBoundsException, DAIllegalArgumentException, NumberFormatException, NotEnoughOperandsException, BadPostfixException
{
try
{
postfix.removeFront();
postfix.removeFront();
postfix.removeFront();
p... | 5 |
public static void verifyPlayerCache(String player) {
PlayerCache cP = getPlayerCache(player);
int temp = 0;
for(String job : cP._playerJobs) {
if(PlayerJobs.getJobsList().containsKey(job)) {
if(!PlayerJobs.getJobsList().get(job).getData().compJob().isDefault())
... | 5 |
public int bonusGain(Territoire t) {
List<Peuple> lstTmp = t.getPrisesDuTerritoire(Partie.getInstance().getTourEnCours());
Iterator<Peuple> it = lstTmp.iterator();
while( it.hasNext() ){
Peuple p = it.next();
if( p == this.peupleLie){
return 1;
}
}
return 0;
} | 2 |
public ParsingResult parse(List<String> strings) {
String name = getName(strings);
strings = beforeEmptyLine(withoutHeader(strings));
List<double[]> matrix = new ArrayList<double[]>();
if (strings.size() != alphabet_size) {
throw new RuntimeException("Incorrect number of weight lines in the transp... | 5 |
public static double biseccion(double extremoIzq, double extremoDer, double epsilon, int cantIter, Funcion fun)
throws Exception {
double p = 0;
while (Math.abs(extremoDer - extremoIzq) >= epsilon && cantIter > 0) {
p = (extremoDer + extremoIzq) / 2; // Punto medio del inter... | 6 |
private void addBallsFromQueue() {
int numBallsToDoInNextCall = 0;//Used to make the method stop when this number of elements
//is in the queue.
Ball waiting = toAdd.peek();
boolean spaceFree = true;
for(Ball b : ballarray) {
if(waiting.getX() >= b.getX() - b.getRadius() && waiting.getX() <= b.getX() + b.g... | 7 |
public static String encrypt(final String pPassword) {
String encryptedPassword = null;
if (pPassword == null) {
throw new NullPointerException();
}
try {
final MessageDigest md = MessageDigest.getInstance("SHA");
md.update((pPassword).getBytes("UTF-8"));
encryptedPassword = new BASE64Encoder().enc... | 3 |
protected void generate() {
String year = this.yearField.getText();
String title = this.titleField.getText();
ArrayList<String> authors = new ArrayList<String>();
for (JTextField textField : this.authorsField) {
authors.add(textField.getText());
}
ArrayList<... | 3 |
@Test
public void testBallConstructor() {
Ball b;
//inbounds x and y, theta
try{
b = new Ball(250,250,1);
assertArrayEquals(new int[]{250,250},b.getPosition());
assertEquals(1,b.getOrientation(),1e-4);
}
catch(IllegalArgumentException e){
fail("Failed requirement: ");
}
//out of bounds (lo... | 9 |
@Override
public int strstr(char[] pattern, char[] string) {
if( pattern.length > string.length )
return -1;
int auxIdx = -1;
for( int i = 0; i < string.length; i++ ) {
for( int j = 0; j < pattern.length; j++ ) {
if( i + j >= string.length )
return -1;
if( string[ i + j ] == pattern[ j ] && j ... | 8 |
public static PacketPlayOutEntityDestroy getDestroyEntityPacket() {
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy();
Field a = ReflectionUtil.getDeclaredField(packet.getClass(), "a");
a.setAccessible(true);
try {
a.set(packet, new int[]{ENTITY_ID});
... | 2 |
public static void main(String[] args) {
if(args.length == 1 && args[0].equals("-dev"))
Configuration.OFFLINE = true;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
/*
* Must disable the strict EDT checking for substance
* (almost must be set before th... | 4 |
public String toString() {
StringBuffer sb = new StringBuffer().append(clazzAnalyzer.getClazz())
.append(".OuterValues[");
String comma = "";
int slot = 1;
for (int i = 0; i < headCount; i++) {
if (i == headMinCount)
sb.append("<-");
sb.append(comma).append(slot).append(":").append(head[i]);
sl... | 4 |
private boolean r_i_verb_suffix() {
int among_var;
int v_1;
int v_2;
// setlimit, line 163
v_1 = limit - cursor;
// tomark, line 163
if (cursor < I_pV)
{
return false;
}
cursor = I_pV;... | 5 |
private String parseTrimmedChecked(String str, int ichStart, int ichMax) {
int ich = ichStart;
char ch;
while (ich < ichMax && ((ch = str.charAt(ich)) == ' ' || ch == '\t'))
++ich;
int ichLast = ichMax - 1;
while (ichLast >= ich && ((ch = str.charAt(ichLast)) == ' ' || ch == '\t'))
--ich... | 7 |
public int getRarestPiece(Peer peer){
updatePiecePrevalence();
int min = Integer.MAX_VALUE;
for(int i = 0; i < this.piecePrevalence.length; i++){
if(this.ourBitfield[i] == false && peer.bitfield[i] == true){
if(min > this.piecePrevalence[i]){
min = piecePrevalence[i];
}
}
}
if(min ... | 9 |
private boolean isValidWorkHour(String shouldWork) {
return (shouldWork.equalsIgnoreCase("z")
|| shouldWork.equalsIgnoreCase("v")
|| shouldWork.equalsIgnoreCase("c")
|| shouldWork.equalsIgnoreCase("k")
|| shouldWork.equals("*")
|| s... | 5 |
private void countUnshelved() throws SQLException
{
Collection<Record> records = GetRecords.create().getAllRecords();
Map<String, Integer> formatCount = new TreeMap<String, Integer>();
for (Record r : records)
if (r.getShelfPos() <= 0 && r.getSoldPrice() < 0)
if (formatCount.co... | 5 |
boolean matchesAny(char... seq) {
if (isEmpty())
return false;
char c = input[pos];
for (char seek : seq) {
if (seek == c)
return true;
}
return false;
} | 3 |
@Override
public void openFiles(OpenFilesEvent event) {
for (File file : event.getFiles()) {
// We call this rather than directly to open(File) above to allow the file opening to be
// deferred until startup has finished
OpenDataFileCommand.open(file);
}
} | 1 |
public TreeNode lca(TreeNode root, TreeNode a, TreeNode b) {
TreeNode left = null;
TreeNode right = null;
if (root == null || root == a || root == b) {
return root;
}
left = lca(root.left, a, b);
right = lca(root.right, a, b);
if (left != null && right != null) {
return root;
} else {
if (left ... | 6 |
@Test
public void readOpmlTree() {
opmlReader.init();
try {
Reader resourceReader = new FileReader(resourceFile);
boolean parseStatus = opmlReader.readDocument(resourceReader);
if (parseStatus) {
Map<String, List<String>> elementTree = opmlReader... | 6 |
@GET
@Produces(MediaType.APPLICATION_JSON)
public String getMeeting(@QueryParam("id") String id) {
String valueToReturn = "";
try {
Meeting meeting = Repository.getMeeting(id);
if (meeting != null) {
MeetingVO.Builder builder = MeetingVO.getBuilder().id(meeting.getId());
for (Vote vote : meeting.get... | 3 |
@Override
public void onCreateDirectory(String arg0, DokanFileInfo arg1)
throws DokanOperationException {
try {
if (DEBUG)
System.out.println("CreateDirectory: " + arg0);
fileSystem.createDirectory(this.mapWinToUnixPath(arg0));
} catch (PathNotFoundException e) {
throw new DokanOperationException(n... | 5 |
private static Unsafe getUnSafe() {
try {
Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
unsafeField.setAccessible(true);
return (Unsafe) unsafeField.get(null);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | 1 |
@Override
public void onKeyPress(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_SPACE || key == KeyEvent.VK_ENTER) {
if (currentSelection == 0) {
setCurrentState(new PlayState());
} else if (currentSelection == 1) {
GameMain.sGame.exit();
}
} else if (key == KeyEvent.VK_UP) {
... | 6 |
public boolean isSpace(){
if (p1 == false && p2 == false && p3 == false && p4 == false && p5 == false && p6 == false){
return true;
}
return false;
} | 6 |
private void naytaLopetusNakyma() {
for (int i = 0; i < soluPainikkeet.length; i++) {
for (int j = 0; j < soluPainikkeet.length; j++) {
JButton soluPainike = soluPainikkeet[i][j];
Solu solu = moottori.getKentta().getSolu(i, j);
soluPainike.setEnabled(f... | 6 |
public final
void downloadPage(ProgressReporter reporter) throws ProblemsReadingDocumentException, InterruptedException {
Main.log(Level.FINE, String.format("Downloading %s from network...%n", url.toString()));
org.jdom2.Document doc = null;
try {
XMLReaderSAX2Factory saxConverter = new XMLReaderSAX2Facto... | 6 |
@SuppressWarnings("deprecation")
public static boolean UserInputs() {
user = new JTextField(15);
pass = new JPasswordField(15);
JPanel myPanel = new JPanel();
myPanel.add(new JLabel("Username:"));
myPanel.add(user);
myPanel.add(Box.createHorizontalStrut(15)); // a spacer
myPanel.add... | 3 |
public static int getCPickerID(String name)
{
for(int i = 0; i < numCPickers; i++)
{
if(cPickers[i].name().equalsIgnoreCase(name))
{
return i;
}
}
return -1;
} | 2 |
public void sendMessageResponse(Response message) throws IOException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException{
if(message instanceof LoginResponse){
//GET CHALLENGE AND BASE 64 ENCODE
byte[] challenge=this.encodeBase64(((LoginRespon... | 1 |
@Override
public boolean supportsDocumentAttributes() {return false;} | 0 |
public long createRoom(int roomNumber) {
roomEntity = new RoomEntity();
roomEntity.create(roomNumber);
return roomEntity.getId();
} | 0 |
private boolean isSpace(char ch) {
switch (ch) {
case ' ':
case '\t':
case '\f':
case 0x0B:
case '\r':
case '\n':
return true;
default:
return false;
}
} | 6 |
@RequestMapping(value = "/{worldId}", method = RequestMethod.GET)
@ResponseBody
public List<Event> getEventsByWorld(@PathVariable int worldId) {
List<Event> result = new ArrayList<Event>();
List<Event> events = data.getEvents();
for(Event event : events) {
if(event.getWorldId() == worldId) {
result.add(e... | 2 |
public MiniAirplaneImage(String imageURL, PlaneColor color)
{
super(imageURL);
totalFrame=3;//3 frames per plane
delayCounter=0;//delay counter starts at 0
//Set the image to military color
if(color==PlaneColor.MILITARY)
{
frameNumber=0;
firstFrame=0;
}
//Set the image to white color
else i... | 4 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
public void readRect(Rect r, CMsgHandler handler) {
int x = r.tl.x;
int y = r.tl.y;
int w = r.width();
int h = r.height();
int[] imageBuf = new int[w * h];
int nPixels = imageBuf.length;
int bytesPerRow = w * (reader.bpp() / 8);
while (h > 0) {
int nRows = nPixels / w;
if (nR... | 2 |
public static void main(String[] args) {
File file;
Scanner scan = null;
try {
file = new File("workAreas.wrk");
scan = new Scanner(file);
HashMap<String, String> workAreaList = new HashMap<String, String>();
String area = null;
while(scan.hasNext()) {
String lin... | 6 |
public String getEncoding() {
if (!isInited) {
try {
init();
} catch (IOException ex) {
IllegalStateException ise = new IllegalStateException("Init method failed.");
ise.initCause(ise);
throw ise;
}
}
return encoding;
} | 2 |
@Override
public void focusLost(FocusEvent e) {
if(e.getSource() == frame.name && frame.name.getText().equals("")) frame.name.setText("Логин");
else if(e.getSource() == frame.password && new String(frame.password.getPassword()).equals("")) frame.password.setText("Пароль");
else if(e.getSourc... | 6 |
public static boolean[] toBooleanA(byte[] data) {
// Advanced Technique: Extract the boolean array's length
// from the first four bytes in the char array, and then
// read the boolean array.
// ----------
if (data == null || data.length < 4) return null;
// ----------
int len = toInt... | 4 |
public static boolean zipDirectoryTo(Path dir, Path destDir, String suffix) throws IOException {
if (!controlDirectory(dir) || !controlDirectory(destDir)) {
return false;
}
DirectoryZip.zipDirectory(dir, destDir, suffix);
return true;
} | 2 |
public Set<BankAccount> getAccountsSatisfying(Checker<BankAccount> checker) {
Set<BankAccount> result = new HashSet<>();
for (BankAccount account: accounts)
if (checker.check(account))
result.add(account);
return result;
} | 2 |
public static void exit(boolean close)
{
Utils.logger.log(Level.INFO, "Exiting main frame...");
Utils.setThreadUpdater(false);
try
{
if(mainFrame != null)
mainFrame.dispose();
}
catch(Exception ignored)
{
}
try
{
socket.close();
}
catch(Exception ignored)
{
}
try
{
Thread.s... | 6 |
public int bwt() {
final int[] SA = this.SA;
final byte[] T = this.T;
final int n = this.n;
final int[] bucketA = new int[BZip2DivSufSort.BUCKET_A_SIZE];
final int[] bucketB = new int[BZip2DivSufSort.BUCKET_B_SIZE];
if (n == 0) {
return 0;
} else if (n == 1) {
SA[0] = T[0];
return 0;
}
in... | 3 |
@Override
public void draw(Graphics graphics, int x, int y) {
int currentLeft = x;
for (UiGlyph uiGlyph : this.uiGlyphs) {
uiGlyph.getGlyph().draw(graphics, currentLeft, y);
currentLeft += uiGlyph.getGlyph().getWidth() + 2;
}
} | 1 |
public void populateList() {
dic = new HashMap<>();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if(Settings.level == 1){input = classLoader.getResourceAsStream("oneLetterWords.txt");}
else if(Settings.level == 2){input = classLoader.getResourceAsStream("twoLetterWords.txt");}
... | 9 |
@Post("json")
public Representation _post1(Representation body) {
if (body == null) {
setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
return null;
}
Map<String, Object> map = mapify(body);
Object stmt_obj = map.get("statement");
if (stmt_obj == null) {
... | 9 |
double evaluateInstanceLeaveOneOut(Instance instance, double [] instA)
throws Exception {
DecisionTableHashKey thekey;
double [] tempDist;
double [] normDist;
thekey = new DecisionTableHashKey(instA);
if (m_classIsNominal) {
// if this one is not in the table
if ((tempDist = (double... | 8 |
private boolean gwFreqHalf (CircularDataBuffer circBuf,WaveData waveData,int pos) {
boolean out;
int sp=(int)samplesPerSymbol100/2;
// First half
double early[]=do100baudFSKHalfSymbolBinRequest(circBuf,pos,lowBin,highBin);
// Last half
double late[]=do100baudFSKHalfSymbolBinRequest(circBuf,(pos+sp),lowBin,h... | 6 |
public static final Integer getInteger(Object value, Integer defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Number) {
return value.getClass() == Integer.class ? (Integer) value : ((Number) value).intValue();
} else if (value instanceof CharSequence && ((CharSequence) valu... | 6 |
public static void main(String[] args) {
if(args.length < 2) {
return;
}
if (args.length > 2) {
System.out.println("Multiplier is: x"+net.acampadas21.pokemine.types.TypeMultiplier.getMultiplier(args[0], args[1], args[2]));
} else {
System.out.println("Multiplier is: x"+net.acampadas21.pokemine.types.Ty... | 2 |
public int takePolyomino(Polyomino p){
for (Block b:p.getContents()){
if (contents[b.getLoc().y][b.getLoc().x]==null){
contents[b.getLoc().y][b.getLoc().x] = b;
}
}
p=null;
int linesCleared=0;
//Clearing rows:
for (int i=contents.le... | 9 |
public MoveResult[] evaluateMove()
{
// setCurrentPlayer(); //random person making first move
MoveResult[] results = new MoveResult[]{new MoveResult(), new MoveResult()};
boolean hit = false;
boolean enemyStunned = false;
int dmg = 0;
AttackResult attackResult;//.. = A... | 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.