text stringlengths 14 410k | label int32 0 9 |
|---|---|
private Map<Integer, Double> calcUptime(File experiment) throws Exception{
//takes in a file, creates the average of each 1m distance bucket in terms of connected or not
Map<Integer, List<Integer>> values = new HashMap<Integer, List<Integer>>();
BufferedReader reader = new BufferedReader(new Fil... | 9 |
public static boolean matchesTypeName(Class<?> clazz, String typeName) {
return (typeName != null && (typeName.equals(clazz.getName())
|| typeName.equals(clazz.getSimpleName()) || (clazz.isArray() && typeName
.equals(getQualifiedNameForArray(clazz)))));
} | 5 |
@Test
public void canGetShoppingCart() {
Map<Integer, Integer> sc = new LinkedHashMap<>();
try {
insertShoppingCart(user1.getEmail(), prod_id1, 20);
insertShoppingCart(user1.getEmail(), prod_id2, 10);
sc = shoppingCart.getShoppingCart(user1);
deleteShoppingCartUser(user1);
} catch (WebshopAppExcept... | 3 |
public int getType()
{
return type;
} | 0 |
public String getBoardSurface() {
String ret = "";
for(int y = 0; y < 9; y++) {
ret += "P" + (y+1);
for(int x = 0; x < 9; x++) {
Player player;
if (attacker.getPieceTypeOnBoardAt(new Point(x, y)) > 0) player = attacker;
else player ... | 9 |
public void setTile(int x, int y, int num)
{
if(isTile(x,y))
sea[x][y] = num;
} | 1 |
public AutoCompletion(final JComboBox comboBox) {
this.comboBox = comboBox;
model = comboBox.getModel();
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (!selecting) highlightCompletedText(0);
}
});... | 8 |
private static boolean check(HashMap<String, Boolean> wordMap, String word,
boolean isSub) {
if (isSub && wordMap.containsKey(word)) { // don't check for the
// original
// word, only for sub-words
System.out.println(word);
return wordMap.get(word);
}
for (int len = 1; len < wor... | 7 |
public static void main( String[] args ) throws InterruptedException, IOException
{
ExecutorService executeService = ThreadPool.getInstance().getExecutorService();
List<Future<Integer>> resultList = new ArrayList<Future<Integer>>();
//约车日期
String date = DateUtil.getFe... | 9 |
public void updateTab(int alg, int alg_){
if(permutation_.get(alg).size() == 0){
for(int i = 0 ; i < tab.size(); i++){
if(tab.get(i) == alg){
tab.remove(i);
}
}
}
boolean isOnTab = false;
for(int i = 0 ; i < tab.size(); i++){
if(tab.get(i) == alg_){
isOnTab = true;
}
}
if(!isOnT... | 6 |
public void close () {
Connection[] connections = this.connections;
if (INFO && connections.length > 0) info("kryonet", "Closing server connections...");
for (int i = 0, n = connections.length; i < n; i++)
connections[i].close();
connections = new Connection[0];
ServerSocketChannel serverChannel = this.se... | 9 |
public boolean pickAndExecuteAnAction(){
/*
* if cashier has just started, go to position
*/
if (mOrders.size() > 0){
synchronized(mOrders) {
for (MarketOrder iOrder : mOrders){
//notify customer if an order has been placed
if ((iOrder.mStatus == EnumOrderStatus.PLACED) && (iOrder.mEvent == Enum... | 7 |
@Override
public Converter put(String key, Converter value) {
Converter v = super.put(key, value);
if (v != null) {
throw new IllegalArgumentException("Duplicate Converter for "
+ key);
}
return v;
} | 2 |
public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException {
/*
* Only print the comment if jump null, since otherwise the block isn't
* completely empty ;-)
*/
if (jump == null)
writer.println("/* empty */");
} | 1 |
public void onKeyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case VK_UP:
case VK_W:
directions.remove(Direction.UP);
break;
case VK_DOWN:
case VK_S:
directions.remove(Direction.DOWN);
break;
case VK_RIGHT:
case VK_D:
directions.remove(Direction.RIGHT);
break;
case VK_LEFT:
ca... | 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 |
public int DoSet(Pos setPos, Stone myColor, boolean provisionalFlg) {
int reverseCnt = 0;
// 設置可能な方向をすべて取得
ArrayList<Pos> doSetDirection = canSetDirection(setPos, myColor);
// 設置可能な方向があるか判断
if (doSetDirection.size() > 0) {
// 設置開始位置に一石置くため、反転カウントに1加算
reverseCnt++;
if (provisionalFlg) {
setColor... | 8 |
@Override
public void startSetup(Attributes atts) {
String min = atts.getValue(A_MIN);
String max = atts.getValue(A_MAX);
String def = atts.getValue(A_DEFAULT);
try {
this.lowerBound = Integer.parseInt(min);
this.upperBound = Integer.parseInt(max);
this.defaultValue = Integer.parseInt(def);
} cat... | 1 |
@Test
public void testTransform() {
System.out.println("transform");
byte[] rawdata = {1,2,3,15,16};
boolean[] expResult = {
false,false,false,false,false,false,false,true,
false,false,false,false,false,false,true,false,
false,false,false,false,false,fals... | 2 |
private static void readData(String path) throws XMLStreamException {
XMLInputFactory factory = XMLInputFactory.newInstance();
File file = new File(path);
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(file))) {
XMLStreamReader reader = factory.createXMLStream... | 2 |
private int checkFourOfAKind(int player) {
int[] hand = new int[players[player].cards.size()];
int i = 0;
for (int card : players[player].cards) {
hand[i++] = card % 13;
}
int matchCount = 0;
for (int j = 0; j < hand.length; j++) {
for (int k = 0; k < hand.length; k++) {
if (j != k) {
... | 6 |
public static void main(String args[]) throws RemoteException, MalformedURLException {
/* 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 an... | 6 |
@EventHandler(priority = EventPriority.MONITOR)
public void onSellTransaction(TransactionEvent event) {
if (event.getTransactionType() != SELL) {
return;
}
String firstLine = SELL_TRANSACTION_FIRST_LINE
.replace("%client", event.getClient().getName())
... | 1 |
@Override
/**
* This method will be used by the table component to get
* value of a given cell at [row, column]
*/
public Object getValueAt(int rowIndex, int columnIndex) {
Object value = null;
Contestant contestant = contestants.get(rowIndex);
switch (columnIndex) {
case COLUMN_CONTESTANT:
value =... | 3 |
@Override
protected void fixAfterInsertion(N x)
{
x.setColour(RED);
while (x != null && x != getRoot() && x.getParent().getColour() == RED)
{
if (parentOf(x) == leftOf(parentOf(parentOf(x))))
{
N y = rightOf(parentOf(parentOf(x)));
if (colorOf(y) == RED)
{
s... | 8 |
@SuppressWarnings("static-access")
@EventHandler(priority = EventPriority.HIGH)
public void onMobDeath (EntityDeathEvent event) {
Entity entity = event.getEntity();
World world = event.getEntity().getWorld();
if (entity instanceof Skeleton) {
Skeleton lich = (Skeleton) entity... | 4 |
private void verifyEntry(Entry entry) {
for (Object key : entry.getExtensionAttributes().keySet()) {
QName qname = (QName) key;
// Foundation 1.9
assertEquals(NAMESPACE, qname.getNamespaceURI());
}
// Atom 2.2
assertTrue(entry.getId().toString... | 6 |
public void setAction(final Action action) {
if (this.action != null) {
removeActionListener(this.action);
action.removePropertyChangeListener(this);
}
this.action = action;
String imgName = LARGE_ICONS.equals(iconDisplay) ? (String) action.getValue(Action.IMAGE_PATH) :
( SMALL_ICONS.... | 9 |
private static HashMap<String, HashMap<String, Double>> getMap() throws Exception
{
BufferedReader reader = new BufferedReader(new FileReader(ConfigReader.getMbqcDir() + File.separator +
"dropbox" + File.separator +
"raw_design_matrix.txt"));
HashMap<String, HashMap<String, Double>> map =new LinkedHa... | 6 |
public Obstacle(){
super((Math.random()*Board.getWIDTH()-Board.robots.get(0).getWidth()), (Math.random()*Board.getHEIGHT()-Board.robots.get(0).getHeight()), 0.0f);
switch(Board.getTheme()){
case "Desert": ii = new ImageIcon(this.getClass().getResource("/resourc... | 4 |
protected void handleTaskSubmittedRequest(Runnable runnable, Address source,
long requestId, long threadId) {
// We store in our map so that when that task is
// finished so that we can send back to the owner
// with the results
_running.put... | 9 |
public void listShowTimes() {
int index = 0;
_showTimes = new ArrayList<ShowTime>(); // To be used for update and remove showTime
System.out.println("ShowTimes");
System.out.println("=========");
for(Cineplex cineplex: cineplexBL.getCineplexes()) {
List<Movie> movies = cineplex.getMovies();
if(movies... | 8 |
public void actionPerformed(ActionEvent event) {
Universe.frameForEnvironment(environment).save(true);
} | 0 |
@Override
public String saveNewAlbum(Album album) throws RemoteException {
try {
List<Album> albums = getAlbums();
album.setUuid(UUID.randomUUID().toString());
List<Artist> artists = getArtists();
Artist artist = null;
for (Artist artist1 : artist... | 5 |
private void doUrls(Document oDoc) throws ForceErrorException, SQLException {
// TODO StringIndexOutOfBoundsException
Elements oLinks = oDoc.select("a[href]");
HashMap<String, Link> links = new HashMap<String, Link>();
int counter = 0;
for (Element oLink : oLinks) {
counter++;
if (counter > Bot.ma... | 5 |
public static final HashMap<String, Course> loadCourseCatalog() throws IOException {
LOGGER.log(Level.INFO, "Loading course catalog..");
HashMap<String, Course> courses = new HashMap<String, Course>();
JSONParser parser = new JSONParser();
File[] files = new File(COURSE_ROOT).listFiles();
for (File file :... | 5 |
public String getTime() {
return time;
} | 0 |
private void closeStatement(Statement statement) {
try (Connection connection = statement.getConnection();) {
connection.commit();
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
} | 1 |
public int[][] makeReflection(int img[][], int kernel) {
for (int i = 0; i < img.length; i++) {
for (int j = 0; j < img[i].length; j++) {
//---- Top ----//
if (i == 0) {
int a = i+2;
//if(a>9) a=9;
if(a>im... | 9 |
@Override
public void run() {
try {
bw = new BufferedReader(new InputStreamReader(
client.getInputStream()));
try {
while (true) {
String line = bw.readLine();
server.handleMessage(clientNR, line);
}
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e1) ... | 3 |
private void linkSrgDataToCsvData()
{
for (Entry<String, MethodSrgData> methodData : srgFileData.srgMethodName2MethodData.entrySet())
{
if (!srgMethodData2CsvData.containsKey(methodData.getValue()) && csvMethodData.hasCsvDataForKey(methodData.getKey()))
{
srgM... | 8 |
private void validate() {
if ( ( getPresentCount() != COUNT_DEFAULT ) && ( getPresentCharacters().size() > 0 )
&& ( getPresentCount() != getPresentCharacters().size() ) ) {
throw new IllegalStateException( "present characters size and count are unequal" );
}
if ( ( ge... | 9 |
public SqlParameter(int type, Object value) {
this.type = type;
this.value = value;
} | 0 |
public void tickDownStatuses(int currentPlayerIndex) {
// Tick down all of the tile's status effects.
for (TileStatus status : statuses) {
status.tickDown(currentPlayerIndex);
if (status.getRemainingDuration() <= 0) {
statuses.remove(status);
//TODO: If we had multiple statuses, then this would cause ... | 2 |
public boolean Apagar(Endereco obj){
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("UPDATE enderecos SET ativo = 0 WHERE id= ?");
comando.setInt(1, obj.getId());
comando.getConnection().commit();
return true;
}ca... | 1 |
public static void playerTurn(Scanner scan, Color player, Board board) {
boolean cont = true;
while (cont) {
System.out.printf("Column to play %s on: ", player.getChar());
int num = 0;
// Gets the players column choice and drops their token there
... | 5 |
public static void main(String[] args)
{
int p[] = { 0, 1, 5, 8, 9, 10, 17, 17, 20, 24, 30};
TDRodCutting topDown = new TDRodCutting(10, p);
System.out.println("Read as, Length of Rod : Cuts : Maximal Revenue");
for ( int i = 1; i <= topDown.n; i++)
System.out.println(i + " : " + topDown.cuts[i] + " : " + t... | 1 |
@SuppressWarnings("nls")
public void write(File file) {
try (PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(file)))) {
mOut = out;
mDepth = 0;
mOut.println("<?xml version=\"1.0\" ?>");
mOut.println("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple... | 4 |
public static void main(String[] args) {
ArrayList<ArrayList<Integer>> lists = new ArrayList<ArrayList<Integer>>();
lists.add(new ArrayList<Integer>());
lists.add(new ArrayList<Integer>());
setReader();
int row = 1;
ArrayList<Integer> newList = lists.get(row%2);
ArrayList<Integer> oldList = lists.get... | 4 |
public LongDataType getCounter() {
return counter;
} | 0 |
public void setVisible(boolean paramBoolean)
{
this.Visible = paramBoolean;
PhysicalObject localPhysicalObject;
int i;
String str;
if (paramBoolean)
{
Enumeration localEnumeration = this.Loopers.elements();////<Vector>
while (localEnumeration.hasMoreElements())
{
loc... | 8 |
public void InsertaFinal(int ElemInser)
{
if ( VaciaLista())
{
PrimerNodo = new NodosProcesos (ElemInser);
PrimerNodo.siguiente = PrimerNodo;
}
else
{
NodosProcesos Aux = PrimerNodo;
while (Aux.siguiente != PrimerNodo)
Aux = Aux.siguiente;
NodosProcesos Nuevo=new NodosProces... | 2 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
lbNome = new javax.swing.JLabel();
tfNome = new javax.swing.JTextField();
tfEndereco = new javax.swing.JTextField();
lbBairro ... | 5 |
public static ArrayList<MeetingRoom> searchRoomByID(String ID) {
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<MeetingRoom>... | 5 |
@Override
public void parse(CommandInvocation invocation, List<ParsedParameter> params, List<Parameter> suggestions)
{
ParsedParameter pParam = this.parseValue(invocation);
if (!params.isEmpty() && params.get(params.size() - 1).getParameter().equals(pParam.getParameter()))
{
... | 2 |
@Override
public void keyReleased(KeyEvent e) {
if ((e.getKeyCode() == KeyEvent.VK_W) || (e.getKeyCode() == KeyEvent.VK_UP)) {
jumpKeyPressed = false;
}
if ((e.getKeyCode() == KeyEvent.VK_D) || (e.getKeyCode() == KeyEvent.VK_RIGHT)) {
rightKeyPressed = false;
}
if ((e.getKeyCode() == KeyEvent.VK_A) || ... | 6 |
public static void writeElementEnd(
StringBuffer buf,
int depth,
String line_ending,
String name
) throws IllegalArgumentException {
if (isValidXMLElementName(name)) {
indent(buf, depth);
buf.append("</").append(name).append(">");
if (line_ending != null) {
buf.append(line_ending);
}
} el... | 2 |
private boolean nextPerm(int[] inPerm){
// returns true if this was successful in finding the next permutation
int[] outPerm = new int[inPerm.length];
for(int i = 0; i < outPerm.length; i++){
outPerm[i] = inPerm[i];
}
// have function (incrementWolf) which returns the next wolf ID, or zero if none
... | 8 |
@Override
public int compareTo(HelperPoint o) {
if (o.relX == relX && o.relY == relY)
return 0;
int f = this.relativeCross(o);
boolean isLess = f > 0 || f == 0 && relativeMDist() > o.relativeMDist();
return isLess ? -1 : 1;
} | 5 |
@Override
public boolean fits(HasPosition p) {
/*
* Check if fits inside the container (i.e parent)
*/
if (! (
(getLeftUpperCornerX() <= p.getLeftUpperCornerX()) &&
(getLeftUpperCornerX() + getWidth() >= p.getLeftUpperCornerX() + p.getWidth()) &&
(getLeftUpperCornerY() <= ... | 7 |
public static void main(String[] args) {
for (Seasons season : Seasons.values()) {
System.out.println(season.name() + " -> " + season);
System.out.println("getName(): " + season.getName() + " getId():" + season.getId());
}
} | 1 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... | 7 |
private boolean evaluateMvdClause(String clause) {
if (model instanceof MesoModel)
return false;
if (clause == null || clause.equals(""))
return false;
String[] sub = clause.split(REGEX_AND);
Mvd.Parameter[] par = new Mvd.Parameter[sub.length];
boolean scalar = false;
byte id;
float vmax;
String d... | 9 |
public boolean deleteGroup(int groupId) {
Connection connection = ConnectionManager.getConnection();
if (connection == null) {
logger.log(Level.SEVERE, "Couln't establish a connection to database");
return false;
}
TopicManager topicManager = new TopicManager();
... | 4 |
public void createTweetStruct() throws ParseException,IOException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy");
simpleDateFormat.setLenient(true);
String line = null;
BufferedReader intermediateDumpReader = new BufferedReader(new FileReader(... | 2 |
public void sortConfectionByCost() {
Collections.sort(confections, new Comparator() {
public int compare(Object ob1, Object ob2) {
Confections co1 = (Confections) ob1;
Confections co2 = (Confections) ob2;
if (co1.getCost() > co2.getCost()) {
... | 2 |
public void start(List<TickerQuotes> _quotes){
try{
System.out.println("Running Quote Thread");
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
DateFormat idateFormat = new SimpleDateFormat("HH:mm:ss");
System.out.println("STILL ALIVE");... | 9 |
public Integer getId() {
return id;
} | 0 |
@Override
public void exec(String channel, String sender, String commandName, String[] args, String login, String hostname, String message) {
try {
SourceServer tf4 = new SourceServer("tf4.joe.to");
tf4.initialize();
System.out.println(tf4.getServerInfo());
th... | 4 |
public void addLocation(DataPoint loc)
{
this.locations.add(loc);
} | 0 |
protected SolexaFastqParser(String id) {
Matcher m = Pattern.compile(REGEX).matcher(id);
// Last guard block
if (!m.matches())
return;
setAttribute(IdAttributes.FASTQ_TYPE, NAME);
for (IdAttributes a : regexAttributeMap.keySet()) {
String value = m.group(regexAttributeMap.get(a));
if (value != null)
... | 3 |
public void modify() throws IOException{ /*Allows user to modify Questions on a given Test. Questions are modified in the Question classes themselves.
This overloaded method of Test also includes modifying of Question answers.*/
boolean repeat = true;
String s;
int val = 0;
while(repeat){
display();
Out.... | 5 |
public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... | 7 |
@Override
public int hashCode() {
return (int) this.appt.getId();
} | 0 |
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (UUID != null ? UUID.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (links != null ? links.hashCode() : 0);
return resul... | 4 |
public boolean conflictWith(Word other) {
int tdx, tdy, odx, ody;
tdx = tdy = odx = ody = 0;
switch ( this.getOrient() ) {
case RIGHT: tdx = 1; break;
case DOWN: tdy = 1; break;
}
switch ( other.getOrient() ) {
case RIGHT: odx = 1; break;
case DOWN: ody = 1; break;
}
int tx = this.getX(), ty... | 8 |
public static void main(String[] args){
MasterFind masterfind = new MasterFind();
ArrayList<String> Master = masterfind.find_baseNumOfCowork();
FileWriter fw;
try {
fw = new FileWriter("parserResult/master.csv");
PrintWriter pw = new PrintWriter(fw);
for(int i = 0; i < Master.size(); i++){
pw.print... | 2 |
public static void multiThreadUpload(String projectName, File loc, String rmPath){
Travel t=new Travel();
t.directoryTravel(loc);
HashMap<String, ArrayList<File>> tl=t.returnTravelList();
ArrayList<File> dl=tl.get("directories");
ArrayList<File> fl=tl.get("files");
SFTP ... | 5 |
private static RealMatrix csvToMatrix(final String sourceFilePath) throws IOException {
BufferedReader in = new BufferedReader(new FileReader(sourceFilePath));
double[][] matrixArray = null;
while (in.ready()) {
String currentLine = in.readLine();
if (currentLine.starts... | 6 |
private void loadDatabaseWithData(String root) {
time = System.currentTimeMillis();
// try to load from obj else {
root += File.separator + "sm" + File.separator;
System.out.println("---*****************************--->>>>>>>" + root);
files_q = new File(root + "q").list();
Arrays.sort(files_q);
files_y =... | 1 |
public static List<Integer> sieveOfEratosthenes(final int max) {
final SieveWithBitset sieve = new SieveWithBitset(max + 1); // +1 to include max itself
for (int i = 3; (i * i) <= max; i += 2) {
if (sieve.isComposite(i))
continue;
// We increment by 2*i to skip even multiples of i
for (int multiplei =... | 5 |
private static void printAll() {
String value;
Iterator iter = queue.iterator();
while(iter.hasNext()) {
value = (String)iter.next();
System.out.print(value+", ");
}
System.out.println();
} | 1 |
private boolean onCommandQuery(CommandSender sender, Command command, String label, String cmd, String[] args)
{
if (sender.hasPermission(ReplicatedPermissionsPlugin.ADMIN_PERMISSION_NODE))
{
String queryPlayerName = getQueryPlayerName(sender, args, 1);
if (!queryPlayerName.equals("CONSOLE"))
{
Ha... | 8 |
@Override
protected void paintComponent(Graphics g) {
if(!isShowing()) return;
super.paintComponent(g);
if(!loadingDone && faderTimer == null) return;
Insets insets = getInsets();
int x = insets.left;
int y = insets.top;
int width = getWidth() - insets.le... | 5 |
public static void editAdress(Adress a){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatemen... | 4 |
public static void readCollection(BusinessCollection businessCollection, File parentFolder){
String businessCollectionName = businessCollection.getName();
File xmlFile = new File(parentFolder, businessCollectionName+".xml");
try {
DocumentBuilderFactory documentBuilderFactory = Docu... | 6 |
public static <T extends Comparable<? super T>> void sort(List<T> input) {
if (input.size() <= 1) {
return;
}
// Going only till input.size() - 1 because as result of swapping the biggest element would be at last index
// naturally
for (int i = 0; i < input.size() - 1... | 6 |
@EventHandler
public void equipmentClick(PlayerInteractEvent e) {
Player player = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR){
ItemStack stack = player.getItemInHand();
if (stack.getTypeId()==397 || stack.getTypeId() == 384 ){
e.setCancelled(tr... | 4 |
private JPanel getPanCode() {
if (panCode == null) {
panCode = new JPanel();
panCode.setBorder(BorderFactory.createTitledBorder("Code :"));
panCode.setLayout(new BoxLayout(this.panCode,BoxLayout.Y_AXIS));
ButtonGroup group=new ButtonGroup();
for(int i=0;i<=Interface.CODES.values().length;i++) {
fin... | 4 |
public static void deleteUnusedFiles(File residentDir, Set<String> fileNames)
{
int count = 0;
if (residentDir.isDirectory())
{
File[] children = residentDir.listFiles();
if (children != null)
{
for (File child : children)
{
try
{
String f... | 8 |
void history(int pt) throws ScriptException {
if (statementLength == 1) {
// show it
showString(viewer.getSetHistory(Integer.MAX_VALUE));
return;
}
if (pt == 2) {
// set history n; n' = -2 - n; if n=0, then set history OFF
checkLength3();
int n = intParameter(2);
if (n < 0)
invalidArgumen... | 7 |
public List<Connection.KeyVal> formData() {
ArrayList<Connection.KeyVal> data = new ArrayList<Connection.KeyVal>();
// iterate the form control elements and accumulate their values
for (Element el: elements) {
if (!el.tag().isFormSubmittable()) continue; // contents are form listabl... | 5 |
public List<Float> getFloatList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<Float>(0);
}
List<Float> result = new ArrayList<Float>();
for (Object object : list) {
if (object instanceof Float) {
r... | 8 |
public final LogoParser.expression_return expression() throws RecognitionException {
LogoParser.expression_return retval = new LogoParser.expression_return();
retval.start = input.LT(1);
Object root_0 = null;
LogoParser.logical_return logical33 =null;
try {
// /... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Student student = (Student) o;
if (age != student.age) return false;
if (group != null ? !group.equals(student.group) : student.group != null) ... | 8 |
public void update()
{
for (int i = 0; i < population.size(); ++i)
{
population.get(i).update();
}
for (int i = 0; i < buildings.length; ++i)
{
for (int j = 0; j < buildings[i].length; ++j)
{
if (buildings[i][j] != null)
{
buildings[i][j].update();
}
}
}
} | 4 |
public 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://download.or... | 6 |
public static Inventory fromString(String s) {
YamlConfiguration configuration = new YamlConfiguration();
try {
configuration.loadFromString(Base64Coder.decodeString(s));
Inventory i = Bukkit.createInventory(null, configuration.getInt("Size"), configuration.getString("Title"));
... | 2 |
public static void setupAmbient(){
File dir = new File(Params.testFolder);
if(dir.exists()){
Ambient.clearAmbient();
}
dir.mkdir();
} | 1 |
public void eliminar(String nombre){
NodoPersonas q = this.inicio;
NodoPersonas t = null;
boolean band = true;
while(q.getInfo().getNombre() != nombre && band){
if(q.getLiga() != null){
t = q;
q = q.getLiga();
}else{
band = false;
}
}
if(!band){
System.out.println("No se encont... | 5 |
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.