text stringlengths 14 410k | label int32 0 9 |
|---|---|
public String toString()
{
String out = "";
if (quantity > 1)
out += quantity;
if (miniCompounds != null && miniCompounds.length > 0)
{
for (int i = miniCompounds.length - 1; i >= 0; i--)
out += miniCompounds[i];
}
else
{
if (miniCompounds == null)
System.err.println("miniCompounds is nu... | 6 |
@Override
public EndPoint getOtherEndPoint() {
if( connection.getSourceEndPoint() == this ){
return connection.getTargetEndPoint();
}
else{
return connection.getSourceEndPoint();
}
} | 1 |
@Test
public void test_intersection() {
HLLCounter h0 = new HLLCounter(true, 1024);
HLLCounter h1 = new HLLCounter(true, 1024);
HLLCounter h2 = new HLLCounter(true, 1024);
HLLCounter h3 = new HLLCounter(true, 1024);
for(int i = 0; i < 10000; i++) {
h0.put(String.valueOf(i));
}
for(in... | 4 |
public boolean containedBy(Box3D box) {
return
(xpos >= box.xpos) &&
(ypos >= box.ypos) &&
(zpos >= box.zpos) &&
(xmax <= box.xmax) &&
(ymax <= box.ymax) &&
(zmax <= box.zmax) ;
} | 5 |
public SortProgram(String s) {
super(s);
setBounds(500,100,350,450);
setLayout(null);
JLabel laInput = new JLabel("Path to input data file:");
laInput.setBounds(105,10,200,15);
add(laInput);
final JTextField tfInput = new JTextField("");
tfInput.setBound... | 9 |
public static int getLastId()
{
String sql = "SELECT idclientes FROM clientes ORDER BY idclientes DESC LIMIT 0,1";
if(!BD.getInstance().sqlSelect(sql)){
return 0;
}
if(!BD.getInstance().sqlFetch()){
return 0;
}
... | 2 |
static public int getImageSizeW()
{
return imageSizeW;
} | 0 |
public String getWeight() {
return weight;
} | 0 |
@Override
public void reactToCollision(Entity other, boolean notOnTheEdge)
{
if (Hidable.class.isInstance(other))
hide((Hidable)other);
if (Eatable.class.isInstance(other) && notOnTheEdge)
eat((Eatable)other);
if (Tail.class.isInstance(other) && notOnTheEdge)
... | 5 |
public boolean equals(final Object obj) {
return ((obj instanceof Label) && (((Label) obj).index == index));
} | 1 |
public static Location extractTarget(AIUnit aiUnit, PathNode path) {
if (path == null) return null;
final Unit unit = aiUnit.getUnit();
final Location loc = path.getLastNode().getLocation();
Settlement settlement = (loc == null) ? null : loc.getSettlement();
return (settlement in... | 6 |
public MonthCount(ReadData data) {
storeIDMap = data.getStoreIDMap();
storeCommentMap = data.getStoreCommentMap();
for (String storeID : storeCommentMap.keySet()) {
String type = storeIDMap.get(storeID).getType();
String[] types = type.split(" ");
for (int i = 0; i < types.length; i++) {
type =... | 6 |
public static int numpadToY(char num){ //returns the y direction of each keypad input.
switch(num){
case('1'):
return 1;
case('2'):
return 1;
case('3'):
return 1;
case('4'):
return 0;
case('6'):
return 0;
case('7'):
return -1;
case('8'):
return -1;
case('9'):
return -1;
def... | 8 |
public static void main(String[] args){
//we make an enhanced for loop.
//we call the class through the object we make
//called sObject. Enumerations make built in arrays
//and we call them as seen down below. values is a key Word
//that can't be changed.
//the sObject loops through the names of the objec... | 2 |
public void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo mutablePersistenceUnitInfo)
{
try
{
Resource[] resources = resourceLoader.getResources("classpath:"+getPath()); //resourceLoader.getResources("classpath:org/myexample/*.class");
for (Resource resource : resources)
... | 3 |
public DeckOfCards(int n){
m_size = n;
m_cards = new HashSet<Card>(m_size);
switch(m_size){
case 54: // 54 Cards
m_cards.add(new Card("Joker1",14));
m_cards.add(new Card("Joker2",14));
case 52: // 52 Cards
for(int i=2;i<=6;i++){
m_cards.add(new Card("Carreau",i));
m_cards.add(new Card("Coe... | 4 |
public static void main(String s[]) throws IOException
{
int denomination[] = { 1, 7, 10 };
//CoinChange cc = new CoinChange(14, denomination);
//System.out.println(cc);
//for (int i = 0; i <= cc.totalAmount; i++)
//System.out.print(cc.n[i] + " ");
BufferedReader br = new BufferedReader(new InputStream... | 1 |
private void drawToMap(List<RiverSection> sections) {
RiverSection oldSection = null;
for (RiverSection section : sections) {
riverMap.put(section.getPosition(), this);
if (oldSection != null) {
section.setBranch(oldSection.direction.getReverseDirection(),
... | 6 |
@Override
public void render() {
glPushMatrix();
{
glTranslatef(getParent().getPosition().getX(),getParent().getPosition().getY(),0);
for(Particle p:particles){
p.render();
}
}
glPopMatrix();
} | 1 |
public static void initialiseGUI() {
gui = new GUI(testWorld);
gui.initaliseWorldMap(testWorld, 0, 0);
} | 0 |
public Util(String[] args) {
if (args.length > 0) parseArguments(args);
filePath = (filePath != null ? filePath : null);
format = (format != null ? format : Arguments.FORMAT_CSV);
sudokuSize = (sudokuSize != null ? sudokuSize : Arguments.SIZE_9x9);
folderPath = (folderPath != null ? folderPath : new Str... | 5 |
private static int createPNG(StdImage image, List<byte[]> imageData, List<Integer> imageType, int type, int dpi) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (!StdImage.writePNG(baos, image, dpi)) {
throw new IOException(UNABLE_TO_CREATE_PNG);
}
byte[] bytes = baos.toByte... | 1 |
@Override
public void draw(Graphics2D g) {
g.drawImage(Images.loadImage("/gui/crafting.png").getSubimage(0, 0, 96, 106), centerX - (96/2), centerY - (106/2),96,106,null);
for(Button b : buttonList){
b.draw(g);
}
for(int slot = 0; slot < player.getInventory().getItems().length; slot++){
ItemStack i = p... | 7 |
public static void main(String[] args) {
int limit = 28123;
ArrayList<Integer> abundantNums = new ArrayList<Integer>();
for (int i = 1; i < limit; i++)
if (abundant(i))
abundantNums.add(i);
int numSumOfAbundant;
boolean[] sumOfAbundant = new boolean[limit + 1];
for (int i = 0; i < abundantNums.size()... | 7 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TipoLogradouro other = (TipoLogradouro) obj;
if (this.idTipoLogradouro != other.idTipoLogradouro && (this... | 5 |
private int findRelevantElement(StackTraceElement[] trace) {
if (trace.length == 0) {
return -1;
} else if (included.size() == 0) {
return 0;
}
int firstIncluded = -1;
for (String myIncluded : included) {
for (int i = 0; i < trace.length; i++) {
StackTraceElement ste = trace[i];
if (ste.getCl... | 9 |
*/
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... | 6 |
private int getSiblingIndex(final int index) {
if (index == 0) {
return 0;
}
if (index % 2 == 0) {
return getLeftChildIndex(getParentIndex(index));
} else {
return getRightChildIndex(getParentIndex(index));
}
} | 2 |
public void selectRegion(Region regionToSelect)
{
// ONLY LOOK FOR IT IF IT EXISTS
if (worldDataManager.hasRegion(regionToSelect))
{
LinkedList<Region> pathToRegion = worldDataManager.getPathFromRoot(regionToSelect);
DefaultMutableTreeNode walker = (DefaultMutableTree... | 6 |
public List<Location> adjacentLocations(Location location) {
assert location != null : "Null location passed to adjacentLocations";
// The list of locations to be returned.
List<Location> locations = new LinkedList<Location>();
if (location != null) {
int row = location.getRow();
int col = location.getCol... | 9 |
public void paintIcon(Component c, Graphics g, int x, int y) {
g.setColor(Color.black);
g.drawLine(x, y + height / 2, x + width, y + height / 2);
g.drawLine(x + width - height / 2, y, x + width, y + height / 2);
g.drawLine(x + width - height / 2, y + height, x + width, y + height
/ 2);
} | 0 |
public boolean IsEmpty(int colonne, int rangee){
if(coordoneeJeu.get(rangee)[colonne]==false){
return true;
}
else{
return false;
}
} | 1 |
public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = ... | 6 |
@Override
public int hashCode() {
return id;
} | 0 |
public void renderLight(Screen screen, int xScroll, int yScroll) {
int xo = xScroll >> 4;
int yo = yScroll >> 4;
int w = (screen.w + 15) >> 4;
int h = (screen.h + 15) >> 4;
screen.setOffset(xScroll, yScroll);
int r = 4;
for (int y = yo - r; y <= h + yo + r; y++) {
for (int x = xo - r; x <= w + xo + r;... | 9 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
Item I=null;
if(affected instanceof Item)
I=(Item)affected;
if((canBeUninvoked())&&(I!=null)&&(I.owner() instanceof MOB)
&&(I.amWearingAt(Wearable.WORN_NECK)))
{
final MOB mob=(MOB)I.owner();
if((!mob.amDead())
&&(mob.isMonster())
... | 8 |
private boolean processFields() {
//
// Validate the category information
//
int type = categoryType.getSelectedIndex();
if (type < 0) {
JOptionPane.showMessageDialog(this, "You must select a category type",
"Error", JOptionP... | 8 |
public boolean opEquals(Operator o) {
return o instanceof StoreInstruction
&& o.operatorIndex == operatorIndex && o.isVoid() == isVoid();
} | 2 |
public Font newFont(float size) {
Font font = null;
InputStream is = null;
is = StageShop.class.getResourceAsStream("/fonts/Perfect DOS VGA 437 Win.ttf");
// is = StageShop.class.getResourceAsStream("/fonts/BMgermar.ttf");
// is = StageShop.class.getResourceAsStream("/fonts/Minecraftia.ttf");
try {
font ... | 2 |
void joinChannel(String cname, Client client) {
if (checkForChannel(cname)) {
Channel c = getChannelByName(cname);
try {
clients.remove(client);
} catch (Exception e) {
e.printStackTrace();
}
if (c.checkUser(client) == f... | 5 |
public void setLeaseDurationMilliseconds(final long leaseDurationMilliseconds) {
//// Preconditions
if (leaseDurationMilliseconds < 2000) {
throw new InvalidParameterException("leaseDurationMilliseconds must be at least 2000");
}
this.leaseDurationMilliseconds = leaseDurationMilliseconds;
} | 1 |
public static Item getItemSomething(String name){
// get item
Item item = ItemStorageInventory.create().getItemfromStorage(name);
if(item != null)
System.out.println("you just get "+ item + " from item list \n");
else
System.out.println("getting "+ item + " failed\n");
return item;
} | 1 |
private void formPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_formPropertyChange
if (evt.getPropertyName().equals("LataaTyopaivat")) {
if (palkanlaskenta.getProfiili() != null) {
malli.clear();
this.tyopaivat = palkanlaskenta.getProfiili().get... | 3 |
private static int partition(int[] array, int start, int end) {
int randomIdx = new Random().nextInt(end-start+1)+start;
// Switch first item with the one of randomIdx
int tmp = array[start];
array[start] = array[randomIdx];
array[randomIdx] = tmp;
int piovtV = array[start];
while(start<end) {
wh... | 7 |
@Override
public void update(double time_difference) {
// TODO Auto-generated method stub
if(host.ip != null){
clientIP = host.ip;
clientName = host.clientName;
Server server = new Server();
}else{
clientIP = null;
clientName = null;
}
switch (connection.getStatus()){
case STATUS_IDLE:
... | 8 |
boolean isDirect(char c) {
return c < 0x80 && (D_SET[c] || (optionalDirect && O_SET[c]));
} | 3 |
public GerarBackup(){
File diretorio = new File(pasta);
File bck = new File(arq);
if (!diretorio.isDirectory()) {
System.out.println("Não Existe!");
new File(pasta).mkdir();
} else {
System.out.println("Exis... | 3 |
public void tick(long delta) {
switch(gameType) {
case 0:
zoneArray[currentZoneX][currentZoneY].tick(delta);
break;
case 1:
break;
}
} | 2 |
public void removeFoundNode(AvlNode q) {
AvlNode r;
// at least one child of q, q will be removed directly
if (q.left == null || q.right == null) {
// the root is deleted
if (q.parent == null) {
if (q.left != null)
this.root = q.left;
... | 9 |
public static void main(String[] args) {
try{
int i = 0; // счетчик подключений
ServerSocket server = new ServerSocket(SERVER_PORT);// слушаем порт 1234
Socket socket;
while(true) {
socket = server.accept();
if (getNumberOfUsers() ... | 8 |
public void addASReplica(XmlNode node, XmlNode replicanode) {
if (node == null || replicanode == null)
return;
List<XmlNode> list = ASreplicsMap.get(node);
if (list != null) {
if (!list.contains(replicanode))
list.add(replicanode);
}
else {
list = new ArrayList<XmlNode>();
list.add(replicanode... | 4 |
public void setEmail(String s)
{
EMAIL = s;
} | 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 swapCards(CardComponent card1, CardComponent card2) {
int index1 = this.getSubComponentIndex(card1);
int index2 = this.getSubComponentIndex(card2);
if (index1 < 0 || index2 < 0) {
return;
}
this.getSlot(index1).unSocket();
this.getSlot(index2).un... | 2 |
private static void setCommonAttributes(EmailDetailsDto emailDto, MultiPartEmail email) throws EmailException, SwingObjectException {
email.setHostName(SwingObjProps.getSwingObjProperty("emailsmtp"));
email.setAuthenticator(new DefaultAuthenticator(emailDto.getEmailID(),emailDto.getPassword()));
email.setFrom(ema... | 7 |
public static void main(String[] args) {
// This counts how many people we had to check
int counter = 0;
// This is the index of the array we update
int index;
// array to contain ALL THE BIRTHDAYS
int[] daysOfYear = new int[365];
// Used to test if its possible for three birthdays to be consecutive up
... | 6 |
private TypeMirror getTypeMirror() {
String methodName = getMethodName();
if (methodName.startsWith("get") || methodName.startsWith("is")) {
List<? extends VariableElement> params = element.getParameters();
if (params.isEmpty()) {
return elemen... | 7 |
public static long S5(){
long numS5 = 0;
// S5: No student should write exams with no break between them
for(Student s : Environment.get().students.objects()){
for(Lecture l1 : s.lectures){
if(l1.session == null) continue;
for(Lecture l2 : s.lectures){
if(l2.session == null) continue;
// lect... | 9 |
public static Equation GenRndEquation(int numOperators){
//Create arrayList of expressions
ArrayList<Expression> eList = new ArrayList<Expression>();
//Create a random
Random rnd = new Random();
//Add a first numerical expression to equationList (First thing in an equation must be a number)
eList.add(new N... | 9 |
public synchronized void take() throws InterruptedException {
while (taken)
wait();
taken = true;
} | 1 |
private void calculateMinMax() {
double[] minFlows = new double[flows.length];
double[] maxFlows = new double[flows.length];
for (int i = 0; i < flows.length; i++) {
minFlows[i] = flows[i].getMin();
maxFlows[i] = flows[i].getMax();
}
this.min = NetPresentValue.npv(minFlows, rate.getMax());
this.max = ... | 1 |
@Column(name = "NOV_AAAAMM")
@Id
public Integer getNovAaaamm() {
return novAaaamm;
} | 0 |
public void checkDead() {
ArrayList<Fish> fishies2 = new ArrayList<Fish>();
for (Fish a : fishies) {
if (a.getHealth() <= 0) {
fishies2.add(a);
}
}
fishies.removeAll(fishies2);
} | 2 |
public static void print(PrintProxy proxy) {
if (proxy != null) {
PrintManager mgr = proxy.getPrintManager();
if (mgr != null) {
mgr.print(proxy);
} else {
WindowUtils.showError(UIUtilities.getComponentForDialog(proxy), NO_PRINTER_SELECTED);
}
}
} | 2 |
public ImageStore () {
MinuetoImage tileImage;
MinuetoImage tempImage;
URL imageLocation;
MinuetoFont arial64B = new MinuetoFont("Arial",64,true,false);
MinuetoFont arial40B = new MinuetoFont("Arial",32,true,false);
this.imageDatabase = new MinuetoImage[128];
try {
... | 8 |
private void initializeTree() {
for (String line : lines) {
if (line != null) {
String[] words = line.split("\\s+");
if (words.length > 0) {
String[] elementAndContact = words[0].split("=");
if (elementAndContact.length == 2)
... | 4 |
public void setUserlistPadding(int[] padding) {
if ((padding == null) || (padding.length != 4)) {
this.userlist_Padding = UIPaddingInits.USERLIST.getPadding();
} else {
this.userlist_Padding = padding;
}
somethingChanged();
} | 2 |
@Override
public void setImages() {
if (waitImage == null) {
File imageFile = new File(Structure.baseDir
+ "MarineSentryGunMkII.png");
try {
waitImage = ImageIO.read(imageFile);
} catch (IOException e) {
e.printStackTrace();
}
}
if (attackImage == null) {
File imageFile = new File(St... | 8 |
private void displayResultSetsInDialog(final JFrame frame, String sql) throws SQLException {
StringBuilder warnings = new StringBuilder();
StringBuilder text = new StringBuilder();
Statement statement = SybaseBuddyApplication.connection.createStatement();
boolean results = statement.execute(sql);
int rowsAffe... | 8 |
@RequestMapping(value = "/assignmentForm")
public ModelAndView showCustomerForm(HttpServletRequest request) {
ModelAndView modelAndView = new ModelAndView("assignmentForm");
String method = request.getParameter("action");
if (method.equals("add")) {
modelAndView.addObject("comma... | 2 |
public static int neighbors(int[][] board, final int x, final int y) {
int neighbors = 0;
for (int i = x - 1; i <= x + 1; i++) {
if (i >= 0 && i < board.length) {
for (int j = y - 1; j <= y + 1; j++) {
if (j >= 0 && j < board[0].length) {
if (!(i == x && j == y)) {
neighbors += board[i][j]... | 8 |
@Test(groups = { "Character-Sorting", "Primitive Sort" })
public void testSelectionSortChar() {
Reporter.log("[ ** Selection Sort ** ]\n");
try {
testSortCharacters = new SelectionSort<>(
primitiveShuffledArrayChar.clone());
Reporter.log("1. Unsorted Random Array\n");
timeKeeper = System.currentTi... | 4 |
public Tree multiplicativeExpressionPro(){
Tree firstConditionalExpression = null, secondConditionalExpression = null;
if((firstConditionalExpression = unaryExpressionPro()) != null){
if((secondConditionalExpression = multiplicativeExpressionDashPro(firstConditionalExpression)) != null){
return secondCondit... | 2 |
private static DRDiffReport doDiffOperationToReport(List<String> bdbLogFileContents, List<String> hadoopLogFileContents, IDiffStrategy diffStrategy) {
int bdbLogFileIndex = 0;
int hadoopLogFileIndex = 0;
int bdbLogFileLength = bdbLogFileContents.size();
int hadoopLogFileLength = hadoopLo... | 8 |
public void testPropertyPlusNoWrapMinute() {
LocalTime test = new LocalTime(10, 20, 30, 40);
LocalTime copy = test.minuteOfHour().addNoWrapToCopy(9);
check(test, 10, 20, 30, 40);
check(copy, 10, 29, 30, 40);
copy = test.minuteOfHour().addNoWrapToCopy(39);
check(c... | 2 |
public static void deleteFile() {
File[] files = FileLister.getFilesArrayFile();
int selection = FileChooser.chooseFile();
if (selection < files.length) {
boolean success = files[selection].delete();
if (success) {
System.out.println(">File successfully deleted");
} else {
System.out.println(">Fi... | 2 |
public void run()
{
List<CyNode> allNodes = new ArrayList<CyNode>();
allNodes = network.getNodeList();
CyRow row;
if(doRestart)
{
for(CyNode currNode : allNodes)
{
row = ColumnsCreator.DefaultNodeTable.getRow(currNode.getSUID());
Double initialOutput = row.get(ColumnsCreator.INITIAL_OUTPUT_VAL... | 7 |
private static void copyMemory(long src, Object dest, long size) {
long sSize = size;
while (size > 0) {
if (size >= 8) {
$.putLong(dest, sSize - size, $.getLong(null, src));
size -= 8;
src += 8;
} else if (size >= 4) {
$.putInt(dest, sSize - size, $.getInt(null, src));
size -= 4;
src ... | 4 |
public Circle score(ShortImageBuffer edges)
{
if(this.x <= this.radius ||
this.y <= this.radius ||
this.x >= (edges.getWidth() - this.radius) ||
this.y >= (edges.getHeight() - this.radius)) return this.scoreCheck(edges);
return this.scoreNoCheck(edges);
} | 4 |
@Override
public void actionPerformed(ActionEvent e) {
final boolean ok = viewMutantsConfiguration.getLiteralOmission().isSelected()
|| viewMutantsConfiguration.getLiteralNegation().isSelected()
|| viewMutantsConfiguration.getClauseOmission().isSelected()
|| ... | 9 |
@SuppressWarnings("unchecked")
public static <K, V> void mergePropertiesIntoMap(Properties props, Map<K, V> map) {
if (map == null) {
throw new IllegalArgumentException("Map must not be null");
}
if (props != null) {
for (Enumeration<?> en = props.propertyNames(); en.hasMoreElemen... | 5 |
public static void startupStrategies() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((M... | 7 |
public void draw(Graphics g){
int x = getX();
int y = getY();
int w = getW();
int h = getH();
if(w < 0){
x +=w;
w *= -1;
}
if(h < 0){
y +=h;
h *= -1;
}
Graphics2D g2 = (Graphics2D) g;
if(getLinePattern())
g2.setStroke(new MyDashStroke(getLineWidth()));
else
g2.setStroke(... | 4 |
@Test
public void getValofRow_test() {
try{
double [][]mat= {{3.0,2.0}, {1.0,3.0}};
int j=0;
double[]result = Matrix.getVecOfRow(mat, j);
double []exp= {3.0,2.0};
Assert.assertArrayEquals(exp, result, 0.0);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not yet implemented"... | 1 |
private void registerManaged(Environment environment) {
final Map<String, Managed> beansOfType = applicationContext.getBeansOfType(Managed.class);
for (String beanName : beansOfType.keySet()) {
Managed managed = beansOfType.get(beanName);
environment.lifecycle().manage(managed... | 1 |
public void setupVaultEconomy() {
if (!hasVaultPlugin() || !manager.isPluginEnabled("Vault") || econHook != null) {
return;
}
RegisteredServiceProvider<Economy> economyProvider = plugin.getServer().getServicesManager().getRegistration(Economy.class);
if (economyProvider != null) {
econHook = economyProvid... | 4 |
public void mate(){
boolean impregnate = false;
Organism partner = null;
for(int o = 0; o < environment.getOrganisms().size(); o ++){
// for(Organism o : environment.getOrganisms()){
if(environment.getOrganisms().get(o).getSpecies () == getSpecies()){
if(environmen... | 9 |
public void escribirPalabras(int lin, String etq, String cod, String ope){
String line;
line = Integer.toString(lin);
try{
BufferedWriter bw = new BufferedWriter(new FileWriter("P2ASM.INST",true));
bw.write(line);
bw.write("\t ");
if(etq.isEmpty())
bw.write("Nul... | 4 |
public static void main(String[] args) {
Sequence sequence = new Sequence(10);
for (int i = 0; i < 10; i++)
sequence.add(Integer.toString(i));
// Selector selector = sequence.selector();
// while (!selector.end()) {
// System.out.print(selector.current() + " ");
// selector.next();
// }
Selector reve... | 2 |
@EventHandler
public void CaveSpiderHarm(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.getCaveSpiderConfig().getDouble("CaveSpide... | 6 |
public static final boolean isJSP(String fileName) {
for (String file : JSP) {
if (file.equals(fileName)) {
return true;
}
}
return false;
} | 2 |
@Override
public int hashCode() {
int result = item != null ? item.hashCode() : 0;
result = 31 * result + (item2 != null ? item2.hashCode() : 0);
result = 31 * result + (item3 != null ? item3.hashCode() : 0);
result = 31 * result + (item4 != null ? item4.hashCode() : 0);
resu... | 8 |
public Case getCaseByDirection(int direction, Case position){
switch(direction){
case 0:
{
if(position.getCaseNumber()-16 > 0){
return this.casefield[position.getCaseNumber()-16];
}
return null;
}
case 1:
{
if(position.getCaseNumber()%16 != 0){
return this.casefield[posi... | 8 |
public static void loadWeightsFromFile(){
File input = null;
Scanner reader = null;
try {
input = new File(".data\\nnsave40_110000newLR");
reader = new Scanner(input);
} catch ( java.io.FileNotFoundException e ) {
try {
input = new File(".data/nnsave40_110000newLR");
reader = new Scanner(input)... | 7 |
public boolean hasPathSum(TreeNode root, int sum) {
if(root == null) return false;
boolean bleft = false, bright=false;
if(root.left==null && root.right==null)
{
if(sum==root.val)
return true;
else
return false;
}
if(root.left != null) bleft =hasPath... | 7 |
public void update(double dt) {
translatePosition = new Vector4(0, 0, 0);
translateLookAt = new Vector4(0, 0, 0);
// moze sie troche dziwne wydawac ale dziala poprawnie
localXAxis.setX(_lookAt.getZ() * -1);
localXAxis.setZ(_lookAt.getX());
localXAxis.normalize();
Vector4D newXAxis = new Vector4(localXAxi... | 5 |
@Override
protected BufferedImage doInBackground() throws Exception {
long starttime = System.nanoTime();
BufferedImage image = new BufferedImage(AREAX, AREAY, BufferedImage.TYPE_INT_RGB);
Graphics g = image.createGraphics();
... | 7 |
private static JPanel[] createEmptyBuckets() {
JPanel[] output = new JPanel[SIZE];
for(int i = 0; i < SIZE; i++) {
output[i] = new JPanel(new GridLayout(0, 1));
}
return output;
} | 1 |
private void showProperty(final String propertyName) throws UnrecognizedCommandException {
java.util.Set<String> properties = Set.properties;
Properties systemProp = Conf.getSystemProperties();
StringBuilder sb = new StringBuilder();
if (null == propertyName) {
int len1 = 0;
for (String name : properties)... | 6 |
private void heapify(int i) {
int pienin;
int l = left(i);
int r = right(i);
if (r <= keonKoko) {
if (taulukko[i] < taulukko[r]) {
pienin = r;
}
else pienin = l;
if (taulukko[i] > taulukko[pienin]) {
vai... | 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.