text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void mouseClicked(MouseEvent e) {
if(e.getComponent().equals(view.Play)){
try {
mode.Play("C:/Users/Dimitris/Downloads/testHY252.mid");
} catch (InvalidMidiDataException | IOException
| MidiUnavailableException | InterruptedException e1) {
// TODO Auto-generated catch block... | 7 |
@Override
public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) {
if (context == null) {
throw new NullPointerException();
}
Object result = null;
if (isResolvable(base)) {
if (params == null) {
params = new Object[0];
}
String name = method... | 7 |
public boolean sendPacket(String ip, int port, byte[] data) {
try {
InetAddress serverAddr = InetAddress.getByName(ip);
tcpSocket = new Socket(serverAddr, port);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
OutputStream os = null;
... | 3 |
public boolean validPosition(int a, int b) {
return a >= 0 && a < height && b >= 0 && b < width;
} | 3 |
public static void main(String[] args) {
System.out.println("Enter value of n:");
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
for(int i=0;i<n;i++)
{
int c=1;
for(int j=0;j<n-i;j++)
{
System.out.print(" ");
} ... | 3 |
private StatInfo doStatsOnDividendSum() {
TreeMap<String,Float> lastDividends = new TreeMap<String,Float>();
for(String ticker: dbSet){
lastDividends.put(ticker, 0f);
}
float[] dividendSums = new float[dbSet.size()];
for (Entry<Float, float[][]> ent : Database.DB_ARRAY.entrySet()) {
int i = 0;
for (f... | 7 |
protected void consumeMethodHeaderName(boolean isAnonymous) {
// MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
// AnnotationMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
// RecoveryMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
MethodDeclaration md = null;
// if(isAnnotationMethod) {
//... | 7 |
public static boolean isBlockSeparator(String s) {
if (s.startsWith("--") && s.endsWith("--")) {
return true;
}
if (s.startsWith("==") && s.endsWith("==")) {
return true;
}
if (s.startsWith("..") && s.endsWith("..")) {
return true;
}
if (s.startsWith("__") && s.endsWith("__")) {
return true;
... | 8 |
public void update(Long id, String title, String message) {
try {
utx.begin();
} catch (NotSupportedException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
}
Message msg = em.find(Message.class, id);
msg.... | 6 |
public String[] getResourceListing(String path) throws URISyntaxException, IOException {
URL dirURL = getClass().getClassLoader().getResource(path);
if (dirURL != null && dirURL.getProtocol().equals("file")) {
return new File(dirURL.toURI()).list();
}
if (dirURL == null) {
String me = getCl... | 7 |
public void setObject( Object o )
{
if( o instanceof GraphicFrame )
{
graphicFrame = (GraphicFrame) o;
}
else if( o instanceof Pic )
{
pic = (Pic) o;
}
else if( o instanceof Sp )
{
sp = (Sp) o;
}
else if( o instanceof CxnSp )
{
cxnSp = (CxnSp) o;
}
else if( o instanceof GrpSp )
... | 5 |
private void siirryAlemmalleSuoritustasolle(int prioriteetti) {
asetaJonoonArvollinen();
while (suoritustasot.size() > prioriteetti) {
nykyinenJono().paataJono();
suoritustasot.remove(suoritustasot.size() - 1);
}
} | 1 |
@Override
public void loadFromString(String contents) throws InvalidConfigurationException {
Preconditions.checkNotNull(contents, "Contents cannot be null");
Map<?, ?> input;
try {
input = (Map<?, ?>) yaml.load(contents);
} catch (YAMLException e) {
throw new... | 8 |
public List<User> DisplayAllUsers (){
List<User> listeUsers = new ArrayList<>();
String requete = "select * from User";
try {
Statement statement = MyConnection.getInstance().createStatement();
ResultSet resultat = statement.executeQuery(requete);
while(res... | 2 |
public OperatingSeat getSeat() {
return this._seat;
} | 0 |
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
for(ListIterator<PExp> i = this._exp_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(newChild != nul... | 3 |
protected void calculateOCGroupDist(ArrayList<Group> gs, ArrayList<Graph.OpinionCluster> ocSet, int agentpool) {
int numGroups = 0;
//numClusters = ocSet.size();
for(Group g: gs) if(g.getAgents().size() > 0) numGroups++;
int ocPos;
double[] ocTrial = new double[ocGroupAverageSet.length];
for(Group g: gs)... | 5 |
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.name).append(" :=").append(NEWLINE);
for(int i=0; i<this.predicates.size(); i++) {
sb.append("\t").append(this.predicates.get(i));
if(i < this.predicates.size() - 1) {
sb.append(",").append(NEWLINE);
}
}
... | 2 |
public int read(char[] cbuf, int off, int len) throws IOException
{
int readAhead = 0;
int read = 0;
int pos = off;
char[] readAheadBuffer = new char[BUFFER_SIZE];
boolean available = true;
while (available && read < len)
{
available = super.read(readAheadBuffer, readAhead, 1) == 1;
if (availa... | 9 |
@EventHandler
public void onArenaPlayerDeath(PADeathEvent e){
FileConfiguration config = Main.getConfig();
Player p = e.getPlayer();
HashSet<ArenaTeam> Teams = e.getArena().getTeams();
for (ArenaTeam team : Teams) {
HashSet<ArenaPlayer> Players = team.getTeamMembers();
for (ArenaPlayer ap : Players) {
... | 5 |
public void award_bonus(BigInteger threshold, BigInteger bonus) {
if (getBalance().compareTo(threshold) >= 0)
deposit(bonus);
} | 1 |
private int getLoginStatus(String username) {
try { // Fisrt test is for Employee
loginStatus.setString(1, username);
resultSet = loginStatus.executeQuery();
while(resultSet.next())
{
status = r... | 8 |
private static void inspect(Object objects){
System.out.println(objects.getClass().getSimpleName());
if(objects instanceof String){
System.out.println("String");
}
if (objects instanceof Car){
System.out.println("Car");
}
if (objects instanceof Veh... | 5 |
public void addCardtoHand(Card x){
hand.add(x);
} | 0 |
protected void processKSFile(File file) throws IOException {
soundPlaying = false;
super.processKSFile(file, RouteParser.scenarioFileRename(this, file.getName())+".ks");
if (lang != Language.EN) {
//Postprocess: remove blank lines and merge lines that belong to a single sentence
StringBuilder sb = ne... | 7 |
public static boolean Edward()
{
double proc = Math.random();
if (proc < 0.2)
return true;
else
return false;
} | 1 |
public String[] completeName(String part) {
Vector<String> ret = new Vector<String>();
if (part.startsWith("_")) {
ret = CodeCompletionUtils.complete(abbrs, part);
} else if (part.endsWith("(")) {
ret = CodeCompletionUtils.complete(part, interpreter, commands, ext_command... | 8 |
protected void initFields() {
if (fieldByName == null) {
if (fieldStr == null) fieldStr = guessFields(); // No fields data? guess them.
fieldNames = fieldStr.split("" + FIELD_NAME_SEPARATOR);
fieldByName = new HashMap<String, Field>();
for (String fname : fieldNames) {
try {
if (!fname.isEmpty(... | 5 |
public void setupGame() {
Dealer dealer = new Dealer();
Scanner input = new Scanner(System.in);
System.out.println("How many players will be playing?");
while (!input.hasNextInt()) {
System.out.println("Please enter a number!");
input.nextLine();
}
numOfPlayers = input.nextInt();
addPlayers(numOfPl... | 2 |
public BBZoomLevelHeader getZoomLevelHeader(int level) {
if(level < 1 || level > zoomLevelsCount)
return null;
return zoomLevelHeaders.get(level - 1);
} | 2 |
private static void printBoatTable(ArrayList<ParkerPaulTaxable> taxables) {
double totalTaxes = 0.00; // total taxes for items
double minTaxes = -1.00; // min taxes for items
double maxTaxes = 0.00; // max taxes for items
int count = 0; // count of items
printBoatHeader();
... | 2 |
public void setUsername(String username) {
this.username = username;
} | 0 |
public BoyerMoore(String pattern, int R) {
this.pattern = pattern;
int M = pattern.length();
// initialize skip table
right = new int[R];
for (int i = 0; i < R; i++) right[i] = -1;
for (int j = 0; j < M; j++) right[pattern.charAt(j)] = j;
} | 2 |
public static File getGameDirectory(int serverIndex){
return new File(getWorkingDirectory(), Settings.serverNames[serverIndex]);
} | 0 |
private void createFile(){
menuFile = new JMenu("File");
menuFile.setMnemonic('I');
menuBar.add(menuFile);
//this is is really important. it fixes a bug.
//when in full screen mode on 2nd monitor the JMenu appears on the wrong
//monitor if the x location isn't specified
menuFile.setMenuLocation(0, 50);
... | 6 |
public void writeLine(String line) throws IOException {
String now = DATE_FORMAT.get().format(new Date());
if (line.indexOf('\n') >= 0 && line.indexOf('\n') < line.length() - 1) {
write((String.format("%s\t\t%s:\n", now, name)).getBytes());
for (String l : line.split("[\\r\\n]+")) {
write((String.format("... | 4 |
@Override
public void run() {
long t = System.currentTimeMillis();
while (!salir) {
if (data.size() > 0) {
gui.printEcualizer(data.get(0));
long n = temp.get(0);
... | 5 |
private void generateBlock(int BlockID) {
switch (BlockID) {
case 0:
generateIBlock();
break;
case 1:
generateLBlock();
break;
case 2:
generateOBlock();
break;
case 3:
... | 5 |
public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s) {
if (s.length() > 1 && isDoubleQuote(s.charAt(0)) && isDoubleQuote(s.charAt(s.length() - 1))) {
return s.substring(1, s.length() - 1);
}
if (s.startsWith("(") && s.endsWith(")")) {
return s.substring(1, s.length() - 1);
}
if (s... | 9 |
public int calMaxPathSum(TreeNode root, int sum) {
if (root == null) return sum;
int leftSum = calMaxPathSum(root.left, sum);
int rightSum = calMaxPathSum(root.right, sum);
if (sum < 0)
sum = root.val;
int maxSumWithCurNode = root.val;
if (rightSum > 0)
... | 9 |
@Override
public DialogFX build() {
final DialogFX CONTROL = new DialogFX();
for (String key : properties.keySet()) {
if ("buttonsLabels".equals(key)) {
CONTROL.addButtons(((ObjectProperty<List<String>>) properties.get(key)).get());
} else if ("buttonsLabels1... | 8 |
public static ServerAddress func_78860_a(String par0Str)
{
if (par0Str == null)
{
return null;
}
String as[] = par0Str.split(":");
if (par0Str.startsWith("["))
{
int i = par0Str.indexOf("]");
if (i > 0)
{
... | 8 |
@Override
public Token parse() {
Token next = first.getNext();
if (!next.isOperator(Operator.BRACKET_LEFT))
throw new RuntimeException("Expected '(' after WHILE, found: " + next);
next = next.getNext();
testExp = new BooleanExpression(next, scope);
next = testExp.parse();
if (!next.isOperator(O... | 3 |
@Override
protected void setColoredExes() {
// TODO Auto-generated method stub
ParametricCurve ermit = new ErmitCurve(allex);
coloredEx = ermit.Calculation();
} | 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://down... | 6 |
public void applyRemovals(){
for (Body b : bodiesToRemove){
if (b != null) {
if (b.getUserData() != null){
Entity e = (Entity) b.getUserData();
if(cam.getFocus().equals(e))
cam.removeFocus();
objects.remove(e);
//ensures player still has access to the character
//after hitt... | 6 |
public void rebondProjectilesStructuresLoop() {
for (int j = 0; j < module.getListStructures().size(); j++) {
for (int i = 0; i < module.getListProjectiles().size(); i++) {
rebondProjectilesStructures(module.getListProjectiles().get(i), module.getListStructures().get(j));
}
}
} | 2 |
public void setAccounting(Accounting accounting) {
setAccounts(accounting == null ? null : accounting.getAccounts());
setAccountTypes(accounting == null ? null : accounting.getAccountTypes());
setJournals(accounting == null ? null : accounting.getJournals());
} | 3 |
private long getDaysFromSeconds(long seconds) {
return seconds / SECONDS_IN_A_DAY;
} | 0 |
void setPickingStyle() throws ScriptException {
checkLength34();
boolean isMeasure = (statement[2].tok == Token.monitor);
String str = null;
Token token = statement[statementLength - 1];
int tok = token.tok;
switch (tok) {
case Token.none:
case Token.off:
str = (isMeasure ? "measureoff" : "toggle");
... | 8 |
private void postPlugin(final boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
final PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
final StringBuilder data = new StringBuilder();
... | 9 |
public void listRecordByPrescribedDate(String start_date, String end_date,
int employee_no) {
String selectQuery = "SELECT r.PATIENT_NO, t.TEST_NAME, p.NAME, r.PRESCRIBE_DATE "
+ "FROM TEST_RECORD r, PATIENT p, TEST_TYPE t "
+ "WHERE r.PATIENT_NO = p.HEALTH_CARE_NO "
+ "AND r.TYPE_ID = t.TYPE_ID "
... | 2 |
private List<CompositeState<TransitionInput>> collectCompositeStates(State<TransitionInput> state) {
List<CompositeState<TransitionInput>> composites = new ArrayList<>();
for(CompositeState<TransitionInput> composite : state.getComposites()) {
int insertionPosition = composites.size();
while(composite != nul... | 2 |
@Override
public void setDbConnString(String dbconnstring) {
this.dbconnstring = dbconnstring;
} | 0 |
public void envoyerDonnee(String donnee)
{
try
{
outStream.writeUTF(donnee);
}
catch(IOException ioe)
{
System.out.println(ioe);
}
} | 1 |
private void loopUntilShutdown() throws Exception {
while (true) {
byte[] incoming = receive();
MessageHandler handler = new MessageHandler(incoming);
if (handler.isShutdownMessage())
break;
byte[] outgoing = handler.createResponseMessage();
... | 2 |
public void initialise() {
// Instantiate a vector of TreeEntity's
treeEntityVector = new Vector <TreeEntity>();
// Fill the vector with the relevant TreeEntity's if they exist.
if(SafetyNet.getSlideShow() != null)
treeEntityVector = SafetyNet.getSlideShow().getTree();
// Remove any current images
if(i... | 4 |
public Transaction bindToTransaction(Map<String, String[]> parameterMap){
Transaction transaction = new Transaction();
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
transaction.setTimestamp(dateFormat.format(cal.getTime()))... | 8 |
public static String fileExt(File f) {
String fileName = f.getName();
int i = fileName.lastIndexOf('.');
if (i > 0) {
return fileName.substring(i+1);
}
return "";
} | 1 |
public String encode(String plain)
{
//Assume plain has a length which is multiply of 25
//Need to generate a key of length x, 25x=length of plain
// if(!is_valid(plain))
// return null;
//add 'X' till the length is a multiply of 25
// if(plain.endsWith("mess"))
/* if(plain.startsWith("thisi... | 9 |
private void initMainFrameButtonActions() {
mainFrame.getButtonGo().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (mainFrame.getAddressField().getText().isEmpty()) {
mainFrame.getButtonGo().setEnabled(false);
... | 4 |
private void createCellArray(String mapFile) {
// Scanner object to read from map file
Scanner fileReader;
ArrayList<String> lineList = new ArrayList<String>();
// Attempt to load the maze map file
try {
fileReader = new Scanner(new File(mapFile));
... | 6 |
@Override
public void sort(int[] array) {
for( int i = array.length-1; i > 0; i--){
for (int j = 0; j < i; j++) {
if(array[j]>array[j+1]){
swap(array, j ,j+1);
}
}
}
} | 3 |
private void masaSureKontrol(){
System.out.println("111111");
for(Bilgisayar b : bilgisayarlar){
if(b.getDurum() == Bilgisayar.Durum.SURELI_ACIK || b.getDurum() == Bilgisayar.Durum.SINIRSIZ_ACIK){
if(b.gecenSureyiArtir()){
suresiBitmisDurumaAl(b);
... | 7 |
public List<TileType> getRelatedTileTypes(TileType tileType) {
List<TileType> relatedTileTypes = new ArrayList<TileType>();
for (TileType t : tileTypes) {
for (String s : tileType.getTags()) {
if (!s.equals("COMMON") && t.getTags().contains(s)) {
relatedTi... | 4 |
public void update() {
tryattack();
xa = 0;
ya = 0;
if (!attacking) {
randommovement();
}
if (anim < 40)
anim++;
else {
anim = 0;
}
if (xa != 0 || ya != 0) {
walking = true;
move(xa, ya);
} else {
walking = false;
}
if (hit) {
if (anim2 < 40)
anim2++;
else {
an... | 7 |
public static void main(String[] args)
{
BaseAccount[] list = new BaseAccount[5];
list[0] = new SavingsAccount("Fred");
list[1] = new ChequeAccount("Jim");
list[2] = new ChequeAccount("Sue");
list[3] = new SavingsAccount("Jim");
list[4] = new SavingsAccount("Jill");
... | 9 |
@Override
public void run() {
while(true) {
try {
String s = "up pressed: " + isUpPressed + ", down pressed: " + isDownPressed +
", spacePressed: " + isSpacePressed;
f.setTitle(s);
... | 2 |
public String getName() {
return name;
} | 0 |
static double grad(int hash, double x, double y, double z) {
int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE
double u = h<8 ? x : y, // INTO 12 GRADIENT DIRECTIONS.
v = h<4 ? y : h==12||h==14 ? x : z;
return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v... | 6 |
@Override
public Object getMetaPacket(Object watcher) {
Class<?> DataWatcher = Util.getCraftClass("DataWatcher");
Class<?> PacketPlayOutEntityMetadata = Util.getCraftClass("PacketPlayOutEntityMetadata");
Object packet = null;
try {
packet = PacketPlayOutEntityMetadata.getConstructor(new Class<... | 9 |
public static boolean moveFile(File src, File dest, boolean eraseOldDirs) {
makeDirs(dest);
if (!src.renameTo(dest)) {
return false;
}
if (eraseOldDirs) {
while ((src = src.getParentFile()) != null) {
if (src.isDirectory() && src.listFiles().length == 0) {
src.delete();
} else {
break;
}... | 5 |
private void lockProgrammProcess(Shell shell) {
System.out.println("Try to get program lock");
initDataDir();
File locker = new File(VCNConstants.LOCK_FILE_PATH);
locker.delete();
boolean isAlreadyLocked = locker.isFile();
if (isAlreadyLocked) {
MessageOKDialog md = new MessageOKDialog... | 2 |
@EventHandler
public void SilverfishHarm(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.getSilverfishConfig().getDouble("Silverfis... | 6 |
private void addToValidPositions(Unit unit, List<Position> validPositions, MovementHelper helper, List<Unit> units) {
boolean hasDifferentColorUnit = false;
if (units == null) {
return;
}
for (Unit otherUnit : units) {
// If the unit has a different color
if (!unit.get... | 5 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
if (ip != null ? !ip.equals(user.ip) : user.ip != null) return false;
if (mac != null ? !mac.equals(user.mac) : user.mac ... | 9 |
public TerrainService clone() {
TerrainService t = super.clone();
for(int i=0;i<super.getNombreColonnes();i++) {
for(int j=0; j<super.getNombreLignes(); j++) {
if(!(t.getBloc(i, j)==super.getBloc(i, j)))
throw new PostConditionError("getNombresColonnes(clone(T)) != getNombresColonnes(T) * getNombresLign... | 3 |
public static void main(String[] args) {
String number = "12";
System.out.println("test val : "+(0-'0')+","+((0-'0')-'0')+",'0' is "+('0'));
int sum = 0;
for (char c : number.toCharArray()) {
sum = sum - (0 - c) - '0';
while (sum >= 3) {
sum -= 3;
}
}
... | 2 |
public static String[] getOptionValues(String option) {
// Try and parse the list on the ";" separator.
String arguments_to_parse = null;
if (CommandLineUtilities._command_line.hasOption(option))
arguments_to_parse = CommandLineUtilities._command_line.getOptionValue(option);
if (CommandLineUtilities._proper... | 2 |
private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 70
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 70
... | 8 |
private void envoyerFichier() {
try {
File file = new File(this.pCheminCible); // Ouverture file
if (file.exists() && file.canRead()) {
//file dans stream
Http.syslog.info("file content:" + this.pCheminCible);
setStatus(CodeResponse.OK.g... | 6 |
public static void deleteWorld(int ID) {
if (ID < 0 || ID > 4) {
if (ChristmasCrashers.isDebugModeEnabled())
System.err.println("Failed to delete world " + ID + " - invalid world ID (must be between 0 and 4, inclusive).");
return;
}
if (worlds[ID] == null) {
if (ChristmasCrashers.isDebugModeEnabled()... | 5 |
public int countTokens(String line, int ich) {
int tokenCount = 0;
if (line != null) {
int ichMax = line.length();
char ch;
while (true) {
while (ich < ichMax && ((ch = line.charAt(ich)) == ' ' || ch == '\t'))
++ich;
if (ich == ichMax)
break;
++token... | 9 |
public Set<Pair> getHBonds() { // positions that are bonded together
//TODO: find ideal way
Set<Pair> hBonds = new HashSet<Pair>();
Set<Integer> usedPoints = new HashSet<Integer>();
int i = 0;
for(Iterator<Point> iter = this.iterator(); iter.hasNext();) {
Point p = iter.next();
RNABasePair pair = this.g... | 7 |
String fileTypeString(int filetype) {
if (filetype == SWT.IMAGE_BMP)
return "BMP";
if (filetype == SWT.IMAGE_BMP_RLE)
return "RLE" + imageData.depth + " BMP";
if (filetype == SWT.IMAGE_OS2_BMP)
return "OS/2 BMP";
if (filetype == SWT.IMAGE_GIF)
return "GIF";
if (filetype == SWT.IMAGE_ICO)
return... | 8 |
public void PlayerFileAccessor(JavaPlugin plugin, String fileName)
{
if (plugin == null)
throw new IllegalArgumentException("plugin cannot be null");
if (!plugin.isInitialized())
throw new IllegalArgumentException("plugin must be initiaized");
this.plugin = plugin;
this.fil... | 3 |
public void remover(AreaConhecimento areaconhecimento) throws Exception
{
String sql = "DELETE FROM areaconhecimento WHERE id = ?";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
stmt.setLong(1, areaconhecimento.getId());
stmt.executeUpdate();
}
catch (SQL... | 1 |
private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 62
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 62
... | 8 |
public static void main(String[] args) throws IOException
{
if(args.length != 2 || args[0].equalsIgnoreCase("help"))
{
System.out.println("Argument is empty! Please provide the path of the input.txt");
System.out.println("B-Tree Path/to/input.txt Path/to/output.txt");
return;
}
FileOutputStream fos... | 5 |
public static MetaData parseMap(final Reader xmlStreamReader, final Parser pzparser) throws JDOMException, IOException {
final Map map = parse(xmlStreamReader, pzparser);
final List<ColumnMetaData> col = (List<ColumnMetaData>) map.get(FPConstants.DETAIL_ID);
map.remove(FPConstants.DETAIL_ID);
... | 2 |
public void actionPerformed(ActionEvent e) {
Object o = e.getSource();
// if it is the Logout button
if(o == logout) {
client.sendMessage(new ChatMessage(ChatMessage.LOGOUT, ""));
return;
}
// if it the who is in button
if(o == whoIsIn) {
client.sendMessage(new ChatMessage(ChatMessage.WHOISIN, ""))... | 9 |
private boolean allWagonsLoaded()
{
boolean condition = true;
java.util.List listOfWagons = getWorld().getObjects(Wagon.class);
if(listOfWagons.size() > 0){
for(int i = 0; i < listOfWagons.size(); i++)
{
Wagon x =(Wagon) listOfWagons.get(i);
... | 4 |
private void searchIndex() {
// if at least one file has been parsed
if( fileIndex.numOfFilesParsed() != 0 ) {
// show an input dialog box and get the file name from user
String searchWord = (String) JOptionPane.showInputDialog( new J... | 4 |
public short[] naive(Node[] nodes) {
short[] tour = new short[nodes.length];
boolean used[] = new boolean[nodes.length];
used[0] = true;
for (short i = 1; i < nodes.length; i++) {
short best = -1;
for (short j = 0; j < nodes.length; j++) {
if (!used[j]
&& (best == -1 || dist(tour[i - 1], j, nod... | 5 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BSTNode bstNode = (BSTNode) o;
if (value != null ? !value.equals(bstNode.value) : bstNode.value != null) return false;
return true;
} | 5 |
@Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if(!sender.hasPermission(pluginMain.pluginManager.getPermission("thf.kick"))){
sender.sendMessage(ChatColor.DARK_RED + "You cannot KICK ME!");
return true;
}
if(args.length == 0){
sender.sendMessa... | 7 |
public void run() {
MessageHandler<E> p = null;
try {
p = c.newInstance();
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} cat... | 7 |
public Object rest() {
if (size() == 0) {
throw new RuntimeException("Cannot remove first element of an empty list.");
} else if ((super.size() == 1) && (!this.isProperList)) {
return this.getDottedElement();
}
final CycList<E> cycList = new CycList<E>(this);
cycList.remove(0);
retur... | 3 |
public List<Type> levelOrderBFT() {
ArrayList<Type> result = new ArrayList<Type>();
LinkedList<BinaryNode> queue = new LinkedList<BinaryNode>();
if(root == null)
return result;
queue.addLast(root);
while(!queue.isEmpty()){
BinaryNode n = queue.removeFirst();
result.add(n.getData());
if(n.get... | 4 |
static <E extends Enum<E>> String toString(EnumSet<E> set) {
if (set == null || set.isEmpty()) {
return "";
} else {
final StringBuilder b = new StringBuilder();
final Iterator<E> i = set.iterator();
b.append(i.next());
for (; i.hasNext();) {
b.append(',').append(i.next());
}
retu... | 3 |
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.