text stringlengths 14 410k | label int32 0 9 |
|---|---|
public PreparedStatement prepare(String query, String... params) {
if (isOpen()) {
try {
PreparedStatement statement = this.connection.prepareStatement(query);
int count = 1;
if (params != null) {
for (String value : params) {
... | 6 |
private ProxyConnection createNewConnection() throws DaoConnectException{
ProxyConnection conn = null;
try {
Class.forName(DB_DRIVER);
Connection connection = (Connection) DriverManager.getConnection(DB_URL, DB_USER_NAME, DB_PASSWORD);
connection.setAutoCommit(false);... | 1 |
public String getLowOrHighDate(String dateone, String datetwo, boolean highestDate) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date1 = sdf.parse(dateone);
Date date2 = sdf.parse(datetwo);
if (date1.compareTo(date2) > 0) {
if (!highestDate) {
return datetwo;
} el... | 6 |
@Override
public void DisableDirection(Direction direction) {
this.direction = direction;
if(current != direction){
if(current != Direction.None){
if(direction != Direction.None){
if(direction != Direction.All){
this.direction = Direction.All;
}
}
}
}
current = ... | 4 |
public double getScore(ArrayList<Object> userAnswers) {
double sum = 0;
ArrayList<Question> questions = getQuestions();
for (int i = 0; i < questions.size(); i++) {
sum += questions.get(i).getScore(userAnswers.get(i));
}
return sum;
} | 1 |
public void laTouche() {
double phi;
double x1, y1, x4, y4, x2 = 0, y2 = 0, x3 = 0, y3 = 0;
x1 = extremiteInitiale.getCoordonnees().getX();
y1 = extremiteInitiale.getCoordonnees().getY();
x4 = extremiteTerminale.getCoordonnees().getX();
y4 = extremiteTerminale.getCoordonnees().getY();
// Reconnaissance ... | 8 |
public static void DBDelete(String[] tCodes){
Connection con = DBase.dbConnection();
PreparedStatement pst =null;
try{
for (String tableCodes : tCodes){
String d = "delete from \"ME\"." + tableCodes;
pst = con.prepareStatement(d);
pst.exe... | 5 |
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
int carry = 0;
int value = 0;
ListNode head;
ListNode temp;
ListNode node;
if (l1 == null || l2 == null) {
return null;
}
value = l1.val + l2.val;
head = new ListNode(value % 10);
node = head;
carry = value / 10;
l1 = l1.next;
l2 = l... | 7 |
public void take(Command command){
if (!command.hasSecondWord()){
System.out.println("take what?");
return;
}
String id = command.getSecondWord();
Item item = currentRoom.getItem(id);
if(item != null)
{
if(item.canBeTaken()){
... | 4 |
public VSequence readSequence()
{
VSequence read = null;
JFileChooser fileChosser = new JFileChooser();
int option = fileChosser.showOpenDialog(VMainWindow.window);
switch (option)
{
case JFileChooser.APPROVE_OPTION:
try
{
... | 4 |
public static RetailFacilityEnumeration fromValue(String v) {
for (RetailFacilityEnumeration c: RetailFacilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} | 2 |
public void addDconst(double d) {
if (d == 0.0 || d == 1.0)
addOpcode(14 + (int)d); // dconst_<n>
else
addLdc2w(d);
} | 2 |
public BufferedImage toBufferedImage(Image image) {
if (image instanceof BufferedImage) {
return (BufferedImage)image;
}
image = new ImageIcon(image).getImage();
boolean hasAlpha = false;
BufferedImage bimage = null;
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
try {
i... | 5 |
public static void deleteBucket(RestS3Service ss, S3Bucket sb) {
try {
ss.deleteBucket(sb.getName());
} catch (ServiceException e) {
e.printStackTrace();
}
} | 1 |
public static String getPropertyDefaultAsString(PropertyContainer container, String key) {
if (container != null) {
Object value = container.getPropertyDefault(key);
return convertObjectToString(value);
} else {
throw new IllegalArgumentException("Provided PropertyContainer was null.");
}
} | 1 |
public void voidVisitAnnotated(Annotated p) {
p.leadingCommentsAccept(this);
noteContext(p.getContext(), !p.getAttributeAnnotations().isEmpty());
p.attributeAnnotationsAccept(this);
List<AnnotationChild> before = (p.mayContainText()
? p.getFollowingElementAnnotations()
... | 8 |
public void aimMyTank() {
for(InfoDetail i : info.getEnemies()) {
int n = 0;
double x = Math.abs(i.getX() - me.getX());
int result = (int)(Math.toDegrees(Math.acos(x / allDistances.get(n))));
if(me.getX() <= i.getX() && me.getY() <= i.getY()) {
... | 7 |
protected FrameDecoder retrieveDecoder(Header header, Bitstream stream, int layer)
throws DecoderException
{
FrameDecoder decoder = null;
// REVIEW: allow channel output selection type
// (LEFT, RIGHT, BOTH, DOWNMIX)
switch (layer)
{
case 3:
if (l3decoder==null)
{
l3decoder = new LayerIIIDec... | 7 |
private void removeAVL(TreeNode startingNode, int searchingKey, int hash) {
currentSearchHeight++;
if (startingNode == null) {
System.out.println("\nKey " + searchingKey + " not found.");
return;
} else {
if (startingNode.key > searchingKey) {
removeAVL(startingNode.left, searchingKey, hash);
} el... | 4 |
private void computeIndexings()
{
//Index the images.
imageData = new int[width][height];
for (int x = 0; x < width; x++)
for (int y = 0; y < height; y++)
{
MultiColor c = new MultiColor(colorCount);
for (int i = 0; i < imageCount; i++)... | 5 |
public void searchBairro() {
if (selectBtnSearchCidade == true && this.cidade.getCidade_id() != null) {
facesContext = FacesContext.getCurrentInstance();
requestContext = RequestContext.getCurrentInstance();
List<Bairro> listBairro;
try {
bairro... | 5 |
public void launch(String command) throws Exception {
// check format
if(! this.launchInstancePattern.matcher(command).matches()) {
System.out.println("Input format is not correct. " + Utils.FORMAT_COMMAND_LAUNCH_INSTANCE);
return;
}
//
RunInstancesRequest request = new RunInstancesRequest();
Strin... | 9 |
private static boolean isPrime(long n){
for(long i=2;i<Math.sqrt(n)+1;i++){
if (n%i == 0) return false;
}
return true;
} | 2 |
public boolean removeInvalidLinks(){
//go over all the links and remove the ones set to false (set all the values to false)
//a boolean to indicate, if something has changed
boolean rval = false;
edgeIterator.reset();
while(edgeIterator.hasNext()){
Edge edge = edgeIterator.next();
if(edge.valid ==... | 2 |
public void move() {
if(inhibit > 0) { inhibit--; };
boolean can_go_straight = can_go_at(x + dx, y + dy);
Random random = new Random();
int r = random.nextInt(17);//(4);
//r = 1;
boolean has_turned = false;
if(r == 0 && inhibit == 0) {
has_turned = turn_left_or_right();
}
if(!has_turned && !ca... | 8 |
@Override
public void hurt(Entity entity, int amount) {
if (!level.creativeMode) {
if (health > 0) {
if (ai != null) {
ai.hurt(entity, amount);
}
if (invulnerableTime > invulnerableDuration / 2F) {
if (lastHe... | 7 |
public static void main(String[] args) throws InterruptedException {
GWCAConnection gwcaConnection = null;
try {
LOG.info("Executing \"Java GWCAConstants\" (version {})", Version.getVersion());
//TODO: Fill in the PID of the running Guild Wars instance here (so replace the 6500... | 3 |
private void addition(int countryCode, int numberToAdd){
if(IPCTrackerKeys.DEBUG_STATUS){
logger.log(CLASS_NAME, "DEBUG: Add");
}
switch(countryCode){
case IPCTrackerKeys.CountryCodes.SU:
logger.log(CLASS_NAME, "Adding: \"" + numberToAdd + "\" to SU");
int currentTotalSU = Integer.parseInt(lblTot... | 6 |
public static int getRankOfSeven(int card_1, int card_2, int card_3, int card_4,
int card_5, int card_6, int card_7) {
long KEY = deckcardsKey[card_1] + deckcardsKey[card_2]
+ deckcardsKey[card_3] + deckcardsKey[card_4]
+ deckcardsKey[card_5] + deckcardsKey[card_6]
+ deckcardsKey[card_7];
int FLUSH_C... | 9 |
public static void solve_equation(Double a, Double b) {
Double d = -b/a;
if(d.isInfinite() || d.isNaN()) System.out.println("INF");
else System.out.println(d);
} | 2 |
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (other == null || getClass() != other.getClass()) {
return false;
}
Pair<?, ?> pair = (Pair<?, ?>) other;
return Objects.equals(first, pair.first) &&
... | 8 |
private static void testKetraDemote(L2PcInstance player)
{
if (player.isAlliedWithKetra())
{
// Drop the alliance (old friends become aggro).
player.setAllianceWithVarkaKetra(0);
final PcInventory inventory = player.getInventory();
// Drop by 1 the level of that alliance (symbolized by a quest ... | 6 |
private String readInput() throws IOException {
return this.keyboard.readLine();
} | 0 |
int[][] generateTigerMove(Board b){ // fn() tested
int[] tigerPositions = new int[3];
int trimLength = 0;
tigerPositions = getTigers(b);
int generatedTigerMoves[][] = new int[12][2];
for(int i=0,j=0; i<3; i++){
if(b.p[tigerPositions[i]].left != null){
if(isThisMoveValidForTiger(Integer.p... | 9 |
private Tuple<String, Integer> getOptionalParameters(String[] args, int i) {
if(i >= args.length) {
// no args left
return new Tuple<String,Integer>("", new Integer(i));
}
if(!args[i].startsWith("(")) {
// does not start with a '(' => no optional parameter.
return new Tuple<String,Integer>("", new Int... | 5 |
private void setBailout() {
if(backup_orbit != null && orbit) {
System.arraycopy(((DataBufferInt)backup_orbit.getRaster().getDataBuffer()).getData(), 0, ((DataBufferInt)image.getRaster().getDataBuffer()).getData(), 0, image_size * image_size);
}
main_panel.repaint();
String... | 9 |
private void createGUI() {
this.setLayout(null);
playButton = new JButton(play);
playButton.setOpaque(false);
playButton.setBorderPainted(false);
playButton.setContentAreaFilled(false);
playButton.setBorder(null);
playButton.setRolloverIcon(play_selected);
... | 4 |
public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
count = new TreeMap<String, ArrayList<String>>();
words = new TreeSet<String>();
for(String line; (line = in.readLine())!=null; ){
if( ... | 7 |
void createListenersGroup () {
listenersGroup = new Group (tabFolderPage, SWT.NONE);
listenersGroup.setLayout (new GridLayout (4, false));
listenersGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, true, true, 2, 1));
listenersGroup.setText (ControlExample.getResourceString ("Listeners"));
/*
* Creat... | 4 |
public void exibir(String num){
String res = null;
for(int i = 0; i < telefonesEUA.size(); i++){
if( telefonesEUA.get(i).equals(num)){
res = telefonesEUA.get(i);
}
}
System.out.println("(1)"+res.substring(0, 4)+"-"+res.substring(4, 8));
} | 2 |
public static void main(String argv[]) throws Exception {
final long startTime = System.currentTimeMillis();
String inputFileName = argv[0];
final String outputFileName = argv[1];
int threadsCount = 4;
if (argv.length > 2) {
threadsCount = Integer.parseInt(argv[2]);
}
GridFactory gridFactory = new Fro... | 2 |
public void run() {
final String fileName = createFileName();
search(fileName);
} | 0 |
private void decompose() {
for (ClassNode classNode : archive)
for (Object node : classNode.methods) {
MethodNode methodNode = (MethodNode) node;
for (AbstractInsnNode abstractInsnNode :
methodNode.instructions.toArray())
if (abstractInsnNode instanceof MethodInsnNode)
scan((MethodInsnNode)... | 4 |
private static int create(int t[]) {
// constante des choix du menu
final String menu[] = {"Début", "Fin", "Spécifier"};
int choix; // contient le choix de l'utilisateur dans le menu
int index; // contient l'index de la case à modifier
String input; // contient la valeur r... | 7 |
@SuppressWarnings("deprecation")
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == btnGo) {
if(!dayComboBox.getSelectedItem().equals("-")) {
ViewAppointmentDatePanel vadp = new ViewAppointmentDatePanel(parent, username, Integer.parseInt((String) dayComboBox.getSelectedItem()),
... | 8 |
private void cookFood(final Food food){
print("Action: cookFood(" + food + ")");
mCookGui.DoGoToFridge();
acquireSemaphore(semAtFridge);
// mInventory.get(food.mChoice).mQuantity--;
EnumItemType iType = Item.enumToEnum(food.mChoice);
mRole.decreaseInventory(iType);
/* //if food amount be... | 6 |
@Override
public void mousePressed(MouseEvent e) {
unprocessedEvents.add(e);
mouse = e.getPoint();
} | 0 |
@Override
public void categoryShow(int refresh) {
// TODO Auto-generated method stub
appListener.getCategory();
jTable1 = new JTable(tablemodel) {
private static final long serialVersionUID = 1L;
/**
*
* @param row row number
*... | 9 |
private String secondsToMinutes(int time) {
int min = time / 60;
int sec = time % 60;
if(min<10)
{
if(sec<10)
return "0"+min+":0"+sec;
return "0"+min+":"+sec;
}
if(sec==0)
return ""+min+":00";
if(sec<10)
return ""+min+":0"+sec;
return ""+min+":"+sec;
} | 4 |
public static void filledRectangle(double x, double y, double halfWidth, double halfHeight) {
if (halfWidth < 0) throw new RuntimeException("half width can't be negative");
if (halfHeight < 0) throw new RuntimeException("half height can't be negative");
double xs = scaleX(x);
double ys ... | 4 |
private static boolean exportar(File file,List<JTable> tablas,List<String> nom_files){
try {
//relaciona el stream de salida con el archivo creado
DataOutputStream out = new DataOutputStream(new FileOutputStream(file));
//crea el libro para guardar el excel
WritableWorkbook w = Workbook.createWorkbook(out... | 4 |
protected void onLogin(String login, String password){
for (LoginListener listener: loginListeners) listener.onLogin(new LoginEvent(login, password));
} | 1 |
public static double svm_predict_probability(svm_model model, svm_node[] x, double[] prob_estimates)
{
if ((model.param.svm_type == svm_parameter.C_SVC || model.param.svm_type == svm_parameter.NU_SVC) &&
model.probA!=null && model.probB!=null)
{
int i;
int nr_class = model.nr_class;
double[] dec_val... | 8 |
public boolean writeReport(String content){
Report report = generateReport(content);
Session session = null;
SessionFactory sessionFactory = null;
try {
Configuration configuration = new Configuration();
configuration.configure();
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder... | 4 |
public final void setMinMeasuredValueDecimals(final int MIN_MEASURED_VALUE_DECIMALS) {
final int DECIMALS = MIN_MEASURED_VALUE_DECIMALS > 5 ? 5 : (MIN_MEASURED_VALUE_DECIMALS < 0 ? 0 : MIN_MEASURED_VALUE_DECIMALS);
if (null == minMeasuredValueDecimals) {
_minMeasuredValueDecimals = MIN_MEASU... | 3 |
public static void setRenderingMode(DrawableComponent component, int mode)
{
if (mode == NORMAL_MODE)
{
//TODO:Normal mode render
}
if (mode == MODEL_MODE)
{
modelMode(component);
}
} | 2 |
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int i = 1;
for (String line; (line = in.readLine())!=null && !line.equals("#"); i++) {
System.out.print("Case "+i+": ");
if(line.equals("HELLO"))
System.out.println( "ENGLIS... | 8 |
public ManaAltar getClosestManaAltar(Point point) {
ManaAltar closestManaAltar = null;
double distance = Double.POSITIVE_INFINITY;
for(Building building : buildings) {
if(building instanceof ManaAltar) {
Point manaAltarPos = new Point(building.getIntX(), building.getIntY());
if(distance > Geometry.squa... | 3 |
private static BigDecimal change(int[] coin_totals, BigDecimal balance, String remainderOf,
int arrayIndex) {
BigDecimal remainder = new BigDecimal(remainderOf);
if(!balance.equals(ZERO_VALUE)) {
BigDecimal monetary_remainder = balance.remainder(remain... | 2 |
@Override
public int getWidth() {
int width = 2;
for (UiGlyph uiGlyph : this.uiGlyphs) {
width += uiGlyph.getGlyph().getWidth();
}
return width;
} | 1 |
public static Polynomial parse(String input) {
Polynomial p = new Polynomial();
input = input.replace(" ", "");
input = input.replace("-", "+-");
input = input.replace("–", "+-");
String[] parts = input.split("\\+");
for (String part : parts) {
if (!(part.trim... | 6 |
private void handleFileSaveAs() {
String chosenFileName = null;
while(JFileChooser.APPROVE_OPTION == fileChooser.showSaveDialog(frame)) {
File file = fileChooser.getSelectedFile();
chosenFileName = file.getAbsolutePath();
if(file.exists()) {
int decision = JOptionPane.showConfirmDialog(frame
,new ... | 5 |
public void uimsg(String msg, Object... args) {
if (msg == "log") {
Color col = null;
if (args.length > 1)
col = (Color) args[1];
out.append((String) args[0], col);
} else if (msg == "btns") {
if (btns != null) {
for (Button... | 7 |
public void showClueNumber(int clueNumber) {
setBackground(Color.WHITE);
setBorder(BorderFactory.createEtchedBorder());
if(clueNumber != 0) {
setFont(new Font(getFont().getName(), Font.BOLD, 16));
setText(Integer.toString(clueNumber));
validate();
}
switch(clueNumber) {
case 1:
setForegrou... | 9 |
public String toString()
{
switch( id )
{
case Ai.TYPE_TEXT:
return getText();
case Ai.TYPE_VALS:
return getDefinition();
case Ai.TYPE_CATEGORIES:
return getDefinition();
case Ai.TYPE_BUBBLES:
return getDefinition();
}
return super.toString();
} | 4 |
public void onAction(String binding, boolean value, float tpf) {
if (binding.equals("Left")) {
keys[0] = value;
} else if (binding.equals("Right")) {
keys[1] = value;
} else if (binding.equals("Up")) {
keys[2] = value;
} else if (binding.equals("Down")) {
keys[3] = value;
} else if (bind... | 8 |
public static Game Create(String name, int width, int height) throws Exception
{
if(game == null)
{
game = new Game(name, width, height);
}
else
{
throw new Exception();
}
return game;
} | 1 |
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String url=req.getServletPath();
HttpSession session=req.getSession();
pm=PMF.get().getPersistenceManager();
if(url.endsWith("/login"))
{
Person p;
UserService userService = UserS... | 5 |
private Double parseFloat() throws StreamCorruptedException {
StringBuffer lenStr = new StringBuffer();
while (input.remaining() > 0) {
char ch = input.get();
if (ch == ';') {
//indexPlus(1);
break;
} else {
lenStr.append(ch);
}
}
Double value = 0D;
try {
value = Double.valueOf(le... | 3 |
private static List<String> getResourcesFromJar(File file, String path, boolean directories) throws IOException {
List<String> resources = new ArrayList<String>();
ZipFile zipFile = null;
try {
zipFile = new ZipFile(file);
Enumeration<? extends ZipEntry> enumeration = z... | 6 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Trip)) return false;
Trip trip = (Trip) o;
if (routes != null ? !routes.equals(trip.routes) : trip.routes != null) return false;
if (vehicle != null ? !vehicle.equals(trip.vehicle) : ... | 6 |
public void visitStaticFieldExpr(final StaticFieldExpr expr) {
if (expr.isDef()) {
sideEffects |= SideEffectChecker.STORE;
}
final MemberRef field = expr.field();
try {
final FieldEditor e = context.editField(field);
if (e.isVolatile()) {
sideEffects |= SideEffectChecker.VOLATILE;
}
conte... | 3 |
public boolean hadNameAtTime(UUID uuid, String name, int timestamp) {
Map<Integer, String> history = this.getNameHistory(uuid);
for (int ts : history.keySet()) {
if (!history.get(ts).equals(name))
continue;
int next = (int) (System.currentTimeMillis() / 1000L);
... | 7 |
public void parseParameters(String paramstring) throws MaltChainedException {
if (paramstring == null) {
return;
}
final String[] argv;
try {
argv = paramstring.split("[_\\p{Blank}]");
} catch (PatternSyntaxException e) {
throw new LibException("Could not split the parameter string '"+paramstring+"'.... | 9 |
public <X extends T> T getValue( Getter<X> populator )
throws ResourceNotFound
{
T value = getValueIfImmediatelyAvailable();
if( value != null ) return value;
while( !lockForPopulation() ) {
synchronized( this ) {
while(beingPopulated) try {
wait();
} catch( InterruptedException e ) {
T... | 8 |
@Override
public void executeMsg(Environmental host, CMMsg msg)
{
if(owner() instanceof MOB)
{
// check to see if this event is a LOOK or EXAMINE event
// and see of the target of the action is the owner of
// this hand of cards, and also check quickly whether
// the player HAS any cards.
if(((msg.... | 8 |
public void generateMap(WumpusGraphics wg) {
if (!mapGenerated) { // ensure we only generate the map once
// generate exactly one wumpus
int wX, wY;
graphics = wg;
do {
wX = (int)(Math.random() * 4);
wY = (int)(Math.random() * 4);
} while (!validWumpusCoord(wX, wY));
... | 8 |
public static Mesh loadMesh(String fileName) {
String[] splitArray = fileName.split("\\.");
String ext = splitArray[splitArray.length - 1];
if (!ext.equals("obj")) {
System.err.println("Error: File format not supported for mesh data: " + ext);
new Exception().printStackT... | 8 |
public static String sendGetRequest(String URL)
{
URL u = null;
try {
u = new URL(URL);
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
String contents = "";
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(u.openStream()));
String line = "";
while ((line... | 4 |
public void tick(){
int left = 0, down = 0, zoom = 0;
if(window.getKey(KeyEvent.VK_LEFT)){left++;}
if(window.getKey(KeyEvent.VK_RIGHT)){left--;}
if(window.getKey(KeyEvent.VK_UP)){down--;}
if(window.getKey(KeyEvent.VK_DOWN)){down++;}
//y = win.pollMouseWheelClicks();
if(window.getKey(KeyEvent.VK_PAGE_U... | 9 |
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 |
public static boolean isLocationVisible(Location l) {
if(NoFoW) return true;
//Check all ships in player's fleet to see if any are within range.
ArrayList<Ship> fleet = players.get(currentPlayer - 1).getFleet();
for(int i = 0; i < fleet.size(); i++) {
Ship s = fleet.get(i);
if(Location.distance(s.getLo... | 6 |
public NamedBinaryTag readNBT() throws IOException
{
final byte type = this.readByte();
if (type == NamedBinaryTag.TYPE_END)
{
return null;
}
final NamedBinaryTag nbt = NBTParser.createFromType(type);
if (nbt != null)
{
nbt.readValue(this);
}
return nbt;
} | 2 |
public int removeNode(XMLTreeNode node, File bitmapFile){
if(node.isFileNode()){
// Remove a file
int numOfBlocks = Integer.parseInt(node.getNode().getAttributes().item(0).toString().split("\"")[1]);
int fileNumber = Integer.parseInt(node.getNode().getAttributes().item(3).to... | 9 |
private void initialize()
{
setLayout(new BorderLayout(10, 10));
setSize(950, 550);
setTitle("MoruTask");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
... | 4 |
public void put(Piece p, int x, int y) {
if ( !isValidMove(x, y) ) {
// direct error info to handler
return;
}
if ( cache[x][y] != null ){
System.err.println( "Please Check Your Move!");
return ;
}
cache[x][y] = p;
} | 2 |
public void loot(){
if(loot.size() > 0){
Game.UI.showLootDialog(loot);
}
} | 1 |
public Employee(int id, String name, int age, int salary) {
this.id = id;
this.name = name;
this.age = age;
this.salary = salary;
} | 0 |
public void set(String path, Object value) {
Configuration root = getRoot();
if (root == null) {
throw new IllegalStateException("Cannot use section without a root");
}
final char separator = root.options().pathSeparator();
// i1 is the leading (higher) index
... | 5 |
public static void oldWriteANOVAs(File outFile, GroupedChannels data,
List<String> groupNames, List<Integer> conditions, int numChunks,
int precision) {
// open file for writing with a nice print stream object:
PrintWriter ostream = makePWriter(outFile); // OKAY VAR NAME?
// get all condition-group sequence... | 6 |
public BaseballGame(String teamOne, String teamTwo) {
this.team1 = teamOne;
this.team2 = teamTwo;
totalGamesPlayed++;
} | 0 |
@EventHandler
public void ZombieFireResistance(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.getZombieConfig().getDouble("Zombie.... | 6 |
public void start() throws Exception {
//TODO executors
new Thread(null, flushManager, "node-manager[" + name + "]").start();
// new Thread(null, compactManager, "compact-manager[" + name + "]").start();
System.out.println("NODE: INFO: Starting Node");
Selector selector;
... | 8 |
public static void main(String args[])throws java.io.IOException{
char choice, ignore;
Help hlpobj = new Help();
for(;;){
do{
hlpobj.showmenu();
choice = (char) System.in.read();
do{
ignore = (char) System.i... | 4 |
public MenuItem getReceiptUiItem() {
if (receiptUiItem == null) {
receiptUiItem = new MenuItem("Show Receipt Panel");
receiptUiItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
new ReceiptListPanel();
} catch (Exception ex) {
ex.printSta... | 2 |
private int findeErsteFigur(Figur[] figurenArray) {
int figurIndex = 0;
boolean figurIstImZiel = false;
do {
int[] aktuellePos = figurenArray[figurIndex].getPosition();
figurIstImZiel = false;
for (int[] zielPosition : getZielPsotionen()) {
if (aktuellePos[0] == zielPosition[0]
&& aktuellePo... | 5 |
public Object bind(Object delegate) {
this.delegate = delegate;
Class<?> cs = delegate.getClass();
return Proxy.newProxyInstance(cs.getClassLoader(), cs.getInterfaces(),
this);
} | 1 |
JPEGHuffman(byte[] data, int[] scan_index){
if (JPEGParser.verbose > 5) {
System.out.println("Building Huffman Table...");
}
mPairs = new TreeMap<String, Integer>();
// 表类型 0--DC 1--AC
mType = data[scan_index[0]] >>> 4;
// 表ID
mID = data[scan_index[0... | 7 |
public static void inint(int n) {
for (int i = 0; i < n; i++)
for (int k = 0; k < n; k++)
if (i != k)
d[i][k] = INF;
else
d[i][k] = 0;
} | 3 |
private double[] getNormalisedData(int width, int height) {
int averageSize = Math.max(data.length / width, 1);
double[] result = new double[data.length / averageSize];
currentMaxValue = Double.NEGATIVE_INFINITY;
// Average the data such that it fits on the x a... | 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.