text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void insert(String in)
{
if(this.isEmpty())
{
Nodes dataList = new Nodes(in);
head = dataList;
}
else if(in.compareTo(this.getData(numberOfItems - 1)) >= 0)
{
Nodes prev = search(numberOfItems - 1);
Nodes newItem = new Nodes(in);
prev.next = newItem;
}
else if(in.compareTo(this.getD... | 5 |
public void close() throws IOException {
if ( this.mBufferedOutputStream != null ) {
boolean delete = false;
try (BufferedInputStream input = new BufferedInputStream( new FileInputStream( this.mTempFile ) )) {
this.mBufferedOutputStream.flush();
this.mBufferedOutputStream.close();
((WaveFileHeader) ... | 6 |
public String status() {
return "#" + id + "(" + (countDown > 0 ? countDown : "LiftOff!") + "), ";
} | 1 |
@SuppressWarnings("resource")
public void menu(DataSource ds) {
while (true) {
try {
System.out.println("Main Menu");
System.out.println("1.Prescribing New Medication");
System.out.println("2.Medical Test Update");
System.out.println("3.Patient Information Update");
System.out.println("4.Searc... | 7 |
public void disposeShaders() {
if (vert != 0) {
GL20.glDetachShader(getID(), vert);
GL20.glDeleteShader(vert);
vert = 0;
}
if (frag != 0) {
GL20.glDetachShader(getID(), frag);
GL20.glDeleteShader(frag);
frag = 0;
}
... | 2 |
public void DrawNumbersToInstantiate(Graphics gr)
{
int numberX = numberInstantiateX;
int numberY = numberInstantiateY;
int numerToPrint = 1;
float tempDrawX = numberX;
int drawX = (int) tempDrawX;
Stroke stroke = new BasicStroke(2);
((Graphics2D) gr).setStroke(stroke);
gr.setColor(Color.black);... | 5 |
public boolean validateMove(String pieceID, int fromPosition, int toPosition, int fromPosition2, int toPosition2) {
boolean valid;
if (currentCard.getRank() == 7){
if (valid = board.validateMove(currentCard.getRank(), pieceID, fromPosition, toPosition, fromPosition2, toPosition2)){
... | 5 |
public static void main(String[] args)
{
int p[] = { 0, 1, 5, 8, 9, 10, 17, 17, 20, 24, 30 };
int n = 10;
BURodCutting bu = new BURodCutting(n, p);
System.out.println("Read as, Length of Rod : Cuts : Maximal Revenue");
for (int i = 1; i <= bu.n; i++)
System.out.println(i + " : " + bu.cuts[i] + " : " + bu... | 1 |
public void raise(int x, int y) {
_map[y][x] += 256;
if (_map[y][x] > 1024) _map[y][x] = 100000;
} | 1 |
@Override
public final Store findStore(String storeNo){
Store storeFound = null;
for(int i = 0; i < stores.length; i++){
if (storeNo.equals(stores[i].getStoreNo())){
storeFound = stores[i];
break;
}
}
if(storeFound == null) {
... | 3 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Solido other = (Solido) obj;
if (this.id != other.id) {
return false;
}
if (!... | 5 |
@Override
public WriteMsg write(FileContent data) throws RemoteException, IOException {
String fileName = data.getFileName();
// check if this is a commit acknowledgment
if (data.getData() == null) {
synchronized (this) {
ReplicaLoc[] locations = locMap.get(fileName);
metaDataWriter.write(fileName);
... | 6 |
public static void readMappings(InputMap im) {
Preferences bindings = PREFS.node("bindings"); //$NON-NLS-1$
try {
boolean changed = false;
for (String key : bindings.keys()) {
String act = bindings.get(key, null);
if (act != null) {
changed = true;
im.put(JoshText... | 5 |
private boolean isLocationInPicture(int column, int row)
{
boolean result = false; // the default is false
if (column >= 0 && column < picture.getWidth() &&
row >= 0 && row < picture.getHeight())
result = true;
return result;
} | 4 |
public Boolean isPermtation( String string1, String string2) {
if (string1 == null && string2 == null) {
return true;
} else if(string1 == null && string2 !=null) {
return false;
} else if(string2 == null && string1 !=null){
return false;
} else {
... | 8 |
@Override
public void onDisable() {
if(!restarting) {
if(config.getBoolean(ServerRestarterConfigNodes.CREATE_STATE_FILE)) {
File file = new File(config.getString(ServerRestarterConfigNodes.STATE_FILE));
if(file.isDirectory())
getLogger().severe("Status file is a directory!");
if(file.exists() && ... | 5 |
public void init()
{
Context.initialize();
// Create a Session
_session = Session.acquire(CommandLine.variable("session"));
if (_session == null)
{
System.out.println("Could not acquire session.");
Context.uninitialize();
System.exit(1);
... | 7 |
void getNeighbors() {
neighborCount = 0;
if (disregardNeighbors)
return;
AtomIterator iter =
frame.getWithinModelIterator(atomI, radiusI + diameterP +
maxRadius);
while (iter.hasNext()) {
Atom neighbor = iter.next();
if (neighbor == atomI)
... | 7 |
private void addOximata(){
/*
* vazei ta oximata tis vashs sthn lista
*/
ArrayList<String> oximata=con.getOximata();
for(int i=0;i<oximata.size();i++){
listModel.addElement(oximata.get(i));
}
} | 1 |
private static boolean isLongFilename( String filename )
{
if( filename.charAt( 0 ) == '.' || filename.charAt( filename.length() - 1 ) == '.' )
return true;
if( !filename.matches( "^\\p{ASCII}+$" ) )
return true;
// no matter whether it is file or directory
int dotIdx = filename.lastIndexOf( '.' );
S... | 8 |
public void imLis(ArrayList<ConstansToken> g) {
for (ConstansToken g1 : g) {
System.out.println(g1.getSimbolo() + " " + g1.getMatch() + " " + g1.getValor());
}
} | 1 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Usuario)) {
return false;
}
Usuario other = (Usuario) object;
if ((this.id == null && other.id != null)... | 5 |
public void step(SimState state) {
Sim.instance().clearOGroups();
Bag freshmen = new Bag();
for(int i = 0; i < Sim.FRESHMAN_CLASS_SIZE; i++){
Student.Race race;
Student.Gender gender;
float racePercent = Sim.instance().random.nextFloat();
if(rac... | 6 |
@Override
public void run() {
while(true) {
try {
Socket socket = server.accept();
BufferedReader inFromClient =
new BufferedReader(new InputStreamReader(socket.getInputStream()));
... | 4 |
public void setMessageAuthScheme(SignatureMethodType value) {
this.messageAuthScheme = value;
} | 0 |
public static void getHelp(Player p, String page) {
int pg = 1;
int tpg = getTotallHelpPG();
if (!page.equalsIgnoreCase("")) {
try {
pg = Integer.parseInt(page);
} catch (Exception e) {
MessageManager.getInstance().error(p, page + " is not a number");
return;
}
}
if (pg > tpg) {
pg = 1... | 5 |
@Override
public String getPotentialContentSizeChangeActionCommand() {
if (mOutlineToProxy != null) {
return mOutlineToProxy.getPotentialContentSizeChangeActionCommand();
}
return super.getPotentialContentSizeChangeActionCommand();
} | 1 |
@Override
public int compareTo(AstronomicalObject o) {
return (this.mass < o.mass) ? -1 : (this.mass > o.mass) ? 1 : 0;
} | 2 |
public static void multTransA_small( RowD1Matrix64F A , D1Matrix64F B , D1Matrix64F C )
{
if( C.numCols != 1 ) {
throw new MatrixDimensionException("C is not a column vector");
} else if( C.numRows != A.numCols ) {
throw new MatrixDimensionException("C is not the expected len... | 8 |
protected static Ptg calcRows( Ptg[] operands ) throws FunctionNotSupportedException
{
try
{
int rsz = 0;
if( operands[0] instanceof PtgStr )
{
String rangestr = operands[0].getValue().toString();
String startx = rangestr.substring( 0, rangestr.indexOf( ":" ) );
String endx = rangestr.substrin... | 9 |
public void stopDiagonal(int otherX, int otherY) {
if (c.freezeDelay > 0)
return;
if (c.freezeTimer > 0) //player can't move
return;
c.newWalkCmdSteps = 1;
int xMove = otherX - c.getX();
int yMove = 0;
if (xMove == 0)
yMove = otherY - c.getY();
/*if (!clipHor) {
yMove = 0;
} else if (!cl... | 4 |
private static boolean doesListContain(String value, List<String> names){
boolean contains = false;
for(String name : names)
{
if (name.contains(value))
contains = true;
}
return contains;
} | 2 |
@EventHandler
public void onBlockPistonExtend(final BlockPistonExtendEvent event){
BlockFace facing = event.getDirection();
if (plugin.gates.isGate(event.getBlock().getRelative(facing))){
plugin.verbose("Piston tried to mess with a KonseptGate by pushing it! BOO!!");
event.s... | 5 |
public static void main(String[]args){
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int d1 = in.nextInt();
int d2 = in.nextInt();
int work = d1*n;
int z = work/d2+((work%d2>0)?1:0);
for (int i = ... | 5 |
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("<tr><td colspan ='3'>");
sb.append("<h3>Experience: ").append(getTitle()+"</h3><br />");
sb.append("Created by: ").append(getCreator()+"<br />");
if(isShared()){
TimelineResource res =... | 5 |
public static HashMap unpack(ByteBuffer buf)
{
HashMap data = new HashMap();
int index = 0;
while (buf.hasRemaining())
{
switch (buf.getInt())
{
case 0:
int valui = buf.getInt();
data.put(index, valui);
... | 4 |
public void AImove(Ball ball, int height) {
cnt++;
if (cnt == 2) {
cnt = 0;
//center = (y + (length / 2));
if (y + length < ball.getY() + ball.getRadius()) {
moveDown();
}
if (y > ball.getY()) {
moveUp();
... | 3 |
public void slaughter(GameWorld gw) {
gw.map[y][x].blood += 1500;
for (int dy = -1; dy < 2; dy++) {
if (y + dy < 0 || y + dy >= gw.map.length) { continue; }
for (int dx = -1; dx < 2; dx++) {
if (x + dx < 0 || x + dx >= gw.map[y].length) { continue; }
if (gw.r.nextInt(3) == 0) {
gw.map[y + dy][x +... | 7 |
public void setExteriorRing(List<LngLatAlt> points)
{
coordinates.add(0, points);
} | 0 |
public boolean hit(ArrayList<Bullet> bullets,int damage){
if( this.isAlive() ){
for(Bullet b:bullets){
//ӵŵʱɱ
if( b.isAlive() && b.getId()!=id ){
if(inside(b)){
//HP
if( hp>0 ){
hp = hp - damage;
}
if( hp<=0 ){
this.setAlive(false);
cx = this.x;
... | 7 |
@Override
public void mousePressed(MouseEvent e) {
if (e.getX() < 0 || e.getY() < 0 || e.getX() > Minesweeper.myWidth * Minesweeper.SIZE || e.getY() > Minesweeper.myHeight * Minesweeper.SIZE) {
return;
}
boolean left = e.getButton() == MouseEvent.BUTTON1,
right = ... | 8 |
static public Vector3f findTetrahedronSimplex(List<Vector3f> simplex){
//A is the point added last to the simplex
Vector3f a = simplex.get(3);
Vector3f b = simplex.get(2);
Vector3f c = simplex.get(1);
Vector3f d = simplex.get(0);
Vector3f ao = a.negate();
V... | 6 |
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
final int n = 2;
MethodOfEilerN.iterCount = 0;
System.out.println("y(k+1)[0] | y(k+1)[1] | t(k+1) ");
while (tk <... | 5 |
private void initialize(){
frame.setTitle("Learn-Words");
frame.setIconImage(MAIN_ICON.getImage());
frame.setSize(WINDOW_SIZE);
// setResizable(false);
frame.setMinimumSize(MIN_WINDOW_SIZE);
frame.setLocation((int) (SCREEN_SIZE.getWidth() / 2 - frame.getWidth() / 2),
... | 1 |
public void loadLayout(InputStream stream) {
Chrono c = new Chrono("loadLayout");
XMLDecoder d = new XMLDecoder(new BufferedInputStream(stream));
Node model = (Node) d.readObject();
Map<?, ?> m = (Map<?, ?>) d.readObject();
d.close();
this.splitPanels.removeAll();
try {
for (Entry<?, ?> e : m.entrySe... | 8 |
public void parse(String fileName){
int i,j;
Sentence s;
NodeList sentences = doc.getElementsByTagName(XML_NODE_SENTENCE);
Node sentenceNode;
Element sentenceElement;
WordSW w;
NodeList words;
Node wordNode;
Element wordElement;
String li... | 7 |
@Override
public Query parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append("ALTER TABLE ");
sB.append(this.t.replace("#__", this.db.getPrefix()));
sB.append("\n ");
if(this.ren) {
sB.append(" RENAME TO ");
sB.append(this.renTo.repla... | 5 |
public static boolean isHellSkeleton (Entity entity) {
if (entity instanceof Skeleton) {
LeatherArmorMeta chestMeta;
ItemStack HSC = new ItemStack(Material.LEATHER_CHESTPLATE, 1,
(short) - 98789);
chestMeta = (LeatherArmorMeta) HSC.getItemMeta();
... | 2 |
@SuppressWarnings("rawtypes")
public static void printList(AbstractList list, int depth)
{
final Iterator i = list.iterator();
Object o = null;
for (int k = 0; k < depth; k++)
System.out.print(" ");
System.out.println("List: ");
while (i.hasNext() && (o = i.next... | 4 |
public Map<Integer, String> getGlobalStringPool() {
return this.stringTable;
} | 0 |
@Test(groups = { "Integer-Sorting", "Primitive Sort" })
public void testSelectionSortInt() {
Reporter.log("[ ** Selection Sort ** ]\n");
try {
testSortIntegers = new SelectionSort<>(
primitiveShuffledArrayInt.clone());
Reporter.log("1. Unsorted Random Array\n");
timeKeeper = System.currentTimeMill... | 4 |
public Word[] verboseAlternatives(Word wordizedSearch){
int n = wordizedSearch.getWord().length();
Word[] words = this.getAlternatives(wordizedSearch);
if(dictionary.contains(wordizedSearch))
return new Word[] {wordizedSearch};
try{
FileWriter fw = new FileWriter(wordizedSearch.getWord() + ".txt");
... | 6 |
public int findThreat(){
int index=-1;
for(int q=0;q<objects.size();q++) {
if (objects.get(q) == this||objects.get(q).kind==kind||objects.get(q).kind==0)
continue;
int searchRadius = 400; //radius of whether the object will be findable
boolean search =... | 8 |
@Override
public boolean removeGroup(String group) {
return groups.remove(group);
} | 0 |
@Override
public void done()
{
try
{
StringBuilder result = get();
textArea.setText(result.toString());
statusLine.setText("Done");
}
catch (InterruptedException ex)
{
}
catch (CancellationException ex)
... | 3 |
public void runStep () {
ArrayList<Node> readyNodes = new ArrayList<Node>();
for (Node node : _nodes) {
if (node.getReady()) {
readyNodes.add(node);
}
}
for (Node node : readyNodes) {
node.sendTrigger();
}
} | 3 |
public VueConnexion(CtrlAbstrait ctrlA) {
super(ctrlA);
initComponents();
VueAbstrait vueA = null;
this.ctrl = new CtrlConnexion(this, vueA);
} | 0 |
public Object parse(String original) throws ValidatorException {
LinkedHashMap<String, String> map = new LinkedHashMap<String,String>();
String[] lines = original.split("\\n+");
for (String line : lines) {
String[] tokens = line.replaceFirst("^\\s+","").split("\\s+");
if (tokens.length > 2)
throw new V... | 8 |
private void doread(ScanfReader scanReader)
throws IOException {
chartData.setEntryList(new Vector<ChartEntry>(10));
HashMap<String, Color> colorList = new HashMap<String, Color>(10);
boolean attributesRead = false;
colorList.put("red", Color.red);
colorList.put("gr... | 8 |
public static Long parseNumericStringObject(Object object) throws InvalidRpcDataException {
if (object == null) {
return null;
}
if (object instanceof String) {
return parseNumericString((String) object);
} else {
throw new InvalidRpcDataException("... | 2 |
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
MessageBlockDef other = (MessageBlockDef) obj;
if (!getOuterType().equals(other.getOuterType())) {
return... | 6 |
public Long getFilmId() {
return filmId;
} | 0 |
public static String postXml(String content,String postUrl) throws IOException{
OutputStreamWriter out = null;
URLConnection con=null;
BufferedReader br = null;
try {
URL url = new URL(postUrl);
con = url.openConnection();
con.setDoOutput(true);
con.setDoInput(true);
con.setRequestProperty("P... | 4 |
public void checkPKReward() {
if(pkpoints == 500000) {
addItem(1038, 1);
sendMessage("Congratz on getting "+pkpoints+" pk points! Have a phat =)");
}
if(pkpoints == 750000) {
addItem(1040, 1);
sendMessage("Congratz on getting "+pkpoints+" pk points! Have a phat =)");
}
if(pkpoints == 100000) {
addItem(1042, 1);
sendMes... | 7 |
public static boolean isInteger(String s) {
if (s == null || s.length() == 0) {
return false;
}
char c = s.charAt(0);
if (s.length() == 1) {
return c >= '0' && c <= '9';
}
return (c == '-' || c >= '0' && c <= '9') && onlyDigits(s.substring(1));
... | 7 |
public String getEmail() {
return this.email;
} | 0 |
private void applyChanges() {
updateGUI();
// Record all the changes.
docSettings.getLineEnd().applyTemporaryToCurrent();
docSettings.getSaveEncoding().applyTemporaryToCurrent();
docSettings.getSaveFormat().applyTemporaryToCurrent();
docSettings.getOwnerName().applyTemporaryToCurrent();
docSettings.get... | 0 |
@Test
public void TestAll() throws IOException, SyntaxFormatException {
for (File file : new File("src/test/resources/testprogs/").listFiles()) {
if (file.isFile()) {
if (file.getPath().indexOf(StatementTest.simpleFuncTest4) >= 0) {
continue;
}
if (!file.getPath().endsWith(".txt")) {
continu... | 4 |
public Scheduler get()
{
return scheduler;
} | 0 |
public void setOption(String option, Collection values) {
if (option.equals("all")) {
onlySUID = false;
} else
throw new IllegalArgumentException("Invalid option `" + option
+ "'.");
} | 1 |
Edge enter(Node branch) {
Node n;
Edge result = null;
int minSlack = Integer.MAX_VALUE;
boolean incoming = getParentEdge(branch).target != branch;
// searchDirection = !searchDirection;
for (int i = 0; i < graph.nodes.size(); i++) {
if (searchDirection)
n = graph.nodes.getNode(i);
else
n = gra... | 8 |
public void register(final JComponent showDate) {
this.showDate = showDate;
showDate.setRequestFocusEnabled(true);
showDate.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {
showDate.requestFocusInWindow();
}
});
... | 5 |
public void testDividedBy_int() {
Minutes test = Minutes.minutes(12);
assertEquals(6, test.dividedBy(2).getMinutes());
assertEquals(12, test.getMinutes());
assertEquals(4, test.dividedBy(3).getMinutes());
assertEquals(3, test.dividedBy(4).getMinutes());
assertEquals(2, te... | 1 |
@EventHandler(priority = EventPriority.LOW)
public void onEntityDeath(EntityDeathEvent e) {
final Entity player = e.getEntity();
for (String worldname : WorldSettings.worlds) {
if (e.getEntity().getWorld().getName().equals(worldname)) {
if (Settings.onDeath) {
e.getDrops().clear();
return;
}
... | 6 |
public final SymbolraetselASTNormalizer.start_return start() throws RecognitionException {
SymbolraetselASTNormalizer.start_return retval = new SymbolraetselASTNormalizer.start_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
CommonTree _first_0 = null;
CommonTre... | 5 |
private void jButtonCalcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCalcActionPerformed
/**This method calculates Monthly Mortgage Payment**/
/**Get Input**/
//Get the vlaue of the text fiels
sPrinciple = jTextFieldPrincipal.getText();
... | 3 |
public static byte[] serialize(Inventory items) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
NbtTagCompound nbtTagCompound = NbtFactory.toCompound(NbtFactory.createTag(NbtType.TAG_CO... | 2 |
public static Mask buildPrewittMask(Direction d) {
switch (d) {
case HORIZONTAL:
double[][] dValues = { { 1, 0, -1 }, { 1, 0, -1 }, { 1, 0, -1 } };
return new Mask(dValues);
case VERTICAL:
double[][] aValues = { { 1, 1, 1 }, { 0, 0, 0 }, { -1, -1, -1 } };
return new Mask(aValues);
case DIAGONAL:
... | 4 |
public static boolean isValidIPAddress(String s) {
String[] nums = s.split("\\.");
if (4 != nums.length) return false;
for (int i = 0; i < nums.length; i++) {
if (nums[i].startsWith("0") && nums[i].length() > 1) return false;
int n = Integer.parseInt(nums[i]);
if (n > 255 || n < 0) re... | 6 |
public static String[] parse(String name) throws IOException, NavException, XPathParseException, XPathEvalException, ParseException{
File f = new File(name);
FileInputStream fis = new FileInputStream(f);
byte[] b = new byte[(int) f.length()];
fis.read(b);
VTDGen vg = new VTDGen();
vg.setDoc(b);... | 4 |
public static void unit_test( final int ARRAY_SIZE ) {
SortAlgorithm[] algorithms = {
new InsertionSort(),
new BubbleSortForLoop(),
new BubbleSortUntilLoop(),
new SelectionSort(),
new MergeSort(),
new InPlaceQuickSort( new LastElementAsPivot() )
};
for( SortAlgorithm algo : algorithms ... | 6 |
public void writeStep(int r, int s, Step step, Data stepData, double finalOF) {
checkFile();
if (w != null) {
this.writeStepHeader();
w.println("-------------------------------");
w.println("Round " + (r+1) + " Step " + step.getName());
... | 5 |
public String getWhois(final String domainName) {
StringBuilder result = new StringBuilder("");
try {
WhoisClient whois = new WhoisClient();
whois.connect(WhoisClient.DEFAULT_HOST);
// whois =google.com
String whoisData = whois.query("=" + domainName);
result.append(whoisData);
whois.disconnect(... | 3 |
protected static boolean resetProtection(Path file) {
assert FileUtil.control(file);
boolean ret = false;
String cmdTmp = RESTOREACL_CMD_1 + file.getParent().toString() + RESTOREACL_CMD_2 + acl
+ file.getFileName().toString().replaceAll("\\.", "") + RESTOREACL_CMD_3;
try... | 1 |
public static String fold( List valueList, final String token )
{
String lastToken = token;
while( true )
{
String foldedToken = foldImpl( valueList, lastToken );
if( foldedToken.equals( lastToken ) )
{
break;
}
else
{
lastToken = foldedToken;
}
}
if( lastToken.length() > LIBINJECTION_SQLI_MAX_TOKENS ... | 6 |
public String getTypeSignature() {
switch (typecode) {
case TC_LONG:
return "J";
case TC_FLOAT:
return "F";
case TC_DOUBLE:
return "D";
default:
return "?";
}
} | 3 |
public Console registerShorcut() {
Event.addNativePreviewHandler(new NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONKEYDOWN && event.getNativeEvent().getShiftKey() && event.getNativeEvent().getAltKey()
&& event.getNativ... | 4 |
@EventHandler
public void WitchInvisibility(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.getWitchConfig().getDouble("Witch.Invis... | 6 |
public boolean hasNext() {
if (matcher == null) {
return false;
}
if (delim != null || match != null) {
return true;
}
if (matcher.find()) {
if (returnDelims) {
delim = input.subSequence(lastEnd, matcher.start()).toString();
... | 8 |
@Override
public ArrayList<Chromosome<T>> update()
{
if(chromoPool.size() % 2 != 0)
{
throw new RuntimeException("Gene pool size is not dividable by 2");
}
ArrayList<Chromosome<T>> newChromoList = new ArrayList<Chromosome<T>>();
double totalF... | 8 |
public void visit_newarray(final Instruction inst) {
final Type type = (Type) inst.operand();
if (type.isReference()) {
final int index = constants.addConstant(Constant.CLASS, type);
addOpcode(Opcode.opc_anewarray);
addShort(index);
} else {
addOpcode(Opcode.opc_newarray);
addByte(type.typeCode())... | 1 |
public Gezin addOngehuwdGezin(Persoon ouder1, Persoon ouder2) {
if (ouder1 == ouder2) {
return null;
}
Calendar nu = Calendar.getInstance();
if (ouder1.isGetrouwdOp(nu) || (ouder2 != null
&& ouder2.isGetrouwdOp(nu))
|| ongehuwdGezinBestaat(oud... | 6 |
public static void runRace() {
try {
while (!exit && !goToMainMenu && !goToPostRaceScreen && !restart) {
// If the display isn't visible (minimised), delay the game more
if (!Display.isVisible()) {
Thread.sleep(200);
}
// If the display is requested to close, exit the program
else if (Di... | 9 |
public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... | 7 |
public final int readShort() throws IOException {
int ch1 = readByte();
int ch2 = readByte();
if(ch1 < 0)
ch1 = BYTE_MAX + ch1;
if(ch2 < 0)
ch2 = BYTE_MAX + ch2;
if ((ch1 | ch2) < 0)
throw new EOFException();
return (ch1 << 8) + (ch2);
} | 3 |
public void testRetainAllArray() {
int element_count = 20;
int ints[] = new int[element_count];
for ( int i = 0; i < element_count; i++ ) {
ints[i] = i;
}
TIntList list = new TIntLinkedList( 20 );
for ( int i = 0; i < element_count; i++ ) {
list.a... | 6 |
public Object getValueAt(int lin, int col) {
Object o=null;
switch (col) {
case 0 : o=lancamentos.get(lin).contaDe;
break;
case 1 : o=lancamentos.get(lin).contaPara;
break;
case 2 : o=String.format("%1$td/%1$tm/%1$tY",lancamentos.get(lin).dataIni);//.getTime();
break;
case 3 : o=String.format("... | 6 |
public String getAddress() {
return address;
} | 0 |
public static void saveObject(Object object, String file_name) {
try {
ObjectOutputStream oos =
new ObjectOutputStream(new BufferedOutputStream(
new FileOutputStream(new File(file_name))));
oos.writeObject(object);
oos.close();
}
catch (IOException e) {
System.err.println("Exception writing ... | 1 |
public Iterator getSprites() {
return sprites.iterator();
} | 0 |
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.