text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void runEngineQueue() {
Engine[] tempStorage = new Engine[engineQueue.size()];
engineQueue.toArray(tempStorage);
for (Engine eng : tempStorage) {
try {
registerEngine(eng);
} catch (EngineException ex) {
System.out.println(ex.getMessage());
}
}
} | 2 |
private static int decode4to3(
byte[] source, int srcOffset,
byte[] destination, int destOffset, int options) {
// Lots of error checking and exception throwing
if (source == null) {
throw new NullPointerException("Source array was null.");
} // end if
... | 8 |
private boolean setFocusIfNeeded(Configuration current, boolean foundFocused) {
Configuration parentConfig = current.getParent();
if (parentConfig == null)
return foundFocused;
if (parentConfig.getFocused()) {
current.setFocused(true);
if (!foundFocused) {
configurations.setFocused(current);
cur... | 3 |
public void wheelUp()
{
if(Panel.contains(Main.mse)&&Page<Pages)
{
Page++;
}
} | 2 |
@Override
public void run() {
if (!automatedProcessesStop.get(metadataId))
try {
logger.info("Sheduled automated thumb choice N°"
+ numberOfTries + " on " + maxNumberOfTries
+ " for metadata " + metadataId + " : try number "
+ numberOfTries);
if (askForMetadataIcons)
logge... | 7 |
private static void runAnalysis(final BufferedReader gcLogReader, final PrintWriter pauseWriter, final PrintWriter percentWriter,
final Date monitoringStartTimestamp) throws IOException, ParseException
{
Date currentDateTime = null;
double totalTime = 0;
d... | 9 |
public List<StudentInfo> getStudent(ClassInfo cls) {
List<CourseEnrollment> erlList = getCourseEnrollment(cls);
StudentManager studentManager = StudentManager.getInstance();
List<StudentInfo> allStd = studentManager.getStudent();
List<StudentInfo> clsStd = new ArrayList<StudentInfo>();
if ((allStd != null) &&... | 5 |
@Override
public Map<String, Boolean> getPermissionsForPlayer(Player player) {
// We try to do handle the maps by reference
// as long as possible, to avoid creating
// new maps over and over
Map<String, Boolean> result = null;
// If we had to make a copy of the result map
... | 4 |
public void run() {
try {
running = true;
while (!stop) {
Thread.sleep(60000);
if (!stop) {
try {
env.checkpoint(null);
}
catch (DatabaseException ex) {
throw new Error(ex);
}
}
}
}
catch (InterruptedException ex) {
if (stop) {
... | 7 |
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("Graph")){
//draw a graph//
String name = nameField.getText();
NameSurferEntry entry = dataFile.findEntry(name);
graph.addEntry(entry);
graph.update();
}else if(e.getActionCommand().equals("Clear")){
//clear the canvas//
... | 2 |
@Override
public boolean execute(final String sender, final String message,
final IRCChannel channel) {
int size = 25;
if (message.length() > 6) {
if (this.validNumber(message.substring(6))) {
size = Integer.parseInt(message.substring(6));
}
... | 4 |
public void createNewProduct(Product newProduct) {
this.em.persist(newProduct);
} | 0 |
public void addAttributeNotEmpty(String name, String value) throws XMLStreamException {
if (value != null && value.length() > 0) {
mWriter.writeAttribute(name, value);
}
} | 2 |
@Override
public void draw() {
for(GraphicalElement poly : childPolygons) {
poly.draw();
}
CompositeClient.addOutput("element finished");
} | 1 |
private boolean unregisterCommand(CommandSender sender, String[] args) {
if (!xPermissions.has(sender, "xauth.admin.unregister")) {
plugin.getMsgHndlr().sendMessage("admin.permission", sender);
return true;
} else if (args.length < 2) {
plugin.getMsgHndlr().sendMessage("admin.unregister.usage", sender);
... | 5 |
public void setjButtonClose(JButton jButtonClose) {
this.jButtonClose = jButtonClose;
} | 0 |
public String getPrueba() {
return prueba;
} | 0 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (obj.getClass() != getClass()) {
return false;
}
Card card = (Card) obj;
if (isBet() || card.isBet()) {
return card.getColor() == this.getColor() && card.getType() == this... | 8 |
public Object[] getArray(String key)
{
if (get(key) instanceof TypedObject && getTO(key).type.equals("flex.messaging.io.ArrayCollection"))
return (Object[])getTO(key).get("array");
else
return (Object[])get(key);
} | 2 |
public void set(String in, int index) {
switch(index) {
case 1:
serviceCode = in;
break;
case 2:
memberNum = in;
break;
case 3:
providerNum = in;
break;
case 4:
currentTime = in;
break;
case 5:
dateOfService = in;
break;
case 6:
comments = in;
break;
case 7:
fee = ... | 8 |
private void massConversionsMenu() throws InterruptedException {
System.out.println();
println("Choose a conversion or enter any integer to go back: ");
println("0: Grams to milligrams");
println("1: Milligrams to grams");
println("2: Grams to kilograms");
println("3: Kilograms to grams");
... | 6 |
public String next() {
StringBuilder b = new StringBuilder();
while (true) {
b.append(line.charAt(idx));
if (idx + 1 >= line.length() || Character.isWhitespace(line.charAt(idx+1))) {
break;
}
idx++;
}
while (true) {
if (idx + 1 >= line.length() || !Character.isWhitespace(line.charAt(idx+1)... | 6 |
public SplitMatch(String pattern, String matchStr, char delimiter) {
if (pattern == null || matchStr == null) {
throw new IllegalArgumentException(
"Pattern and String must not be null");
}
this.pattern = pattern;
this.matchStr = matchStr;
ptnLen... | 4 |
public Direction clockwise(){
if (this.equals(NORTH)){
return NORTHEAST;
} else if (this.equals(NORTHEAST)){
return EAST;
} else if (this.equals(EAST)){
return SOUTHEAST;
} else if (this.equals(SOUTHEAST)){
return SOUTH;
} else if (this.equals(SOUTH)){
return SOUTHWEST;... | 8 |
@SuppressWarnings("deprecation")
public void processLoginRequest(OMMSolicitedItemEvent event)
{
OMMMsg msg = event.getMsg();
Token token = event.getRequestToken();
byte msgType = msg.getMsgType();
System.out.println(_instanceName + " Received Login " + OMMMsg.MsgType.toString(ms... | 8 |
public int getRelativeWindDirection(){
int dir = this.absoluteWindDirection - this.heading;
if(dir < 0) dir = 360 + dir;
return dir;
} | 1 |
private static int fastfloor(double x) {
int xi = (int) x;
return x < xi ? xi - 1 : xi;
} | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AnagramWord other = (AnagramWord) obj;
if (characterMap == null) {
if (other.characterMap != null)
return false;
} else if (!characterMa... | 6 |
private SparseVectorN extractWordGrams(StringTokenizer tokenizer)
{
SparseVectorN x = new SparseVectorN();
assert (ngrams > 0);
String t = null;
String l = null;
String ll = null;
String lll;
for (;tokenizer.hasMoreTokens();)
{
// Circu... | 8 |
public void mouseDragged(MouseEvent e) {
DonkeyGUI donkeyGui = DonkeyGUI.getInstance(guiBuilder);
MaskPanel mask = guiBuilder.getMaskPanel();
ImageLabel source = (ImageLabel) e.getSource();
imageX = e.getX();
imageY = e.getY();
source.setLocation(imageX + source.getX() - source.getWidth() / 2, imageY + sour... | 5 |
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int i;
boolean isPrime = true;
System.out.println("Please enter a number (integer).");
System.out.println("Enter '0' to exit the program.");
String str = s.nextLine();
... | 5 |
private synchronized void processEvent(Sim_event ev) {
double now = GridSim.clock();
if(ev.get_src() == myId_) {
// time to update the schedule, finish jobs
// finish reservations, start jobs
if (ev.get_tag() == UPT_SCHEDULE) {
if(now > lastSchedUpt) {
updateSchedule();
... | 3 |
private boolean checkImpactWall() {
boolean hasBouncedOffWall = false;
// If ball is touching the ground and
// if energy is pointing down (It's positive)
if((ballY >= (PHEIGHT-10)) && (yEnergy > 0)) {
lives--;
if(yEnergy >= minEnergyAtImpact) {
yEnergy = ((yEnergy * 0.80f) - 80) * -1;
hasBouncedO... | 7 |
public JSONObject append(String key, Object value) throws JSONException {
testValidity(value);
Object object = this.opt(key);
if (object == null) {
this.put(key, new JSONArray().put(value));
} else if (object instanceof JSONArray) {
this.put(key, ((JSONArray)objec... | 2 |
private int jjMoveStringLiteralDfa7_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(5, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(6, active0);
return 7;
}
switch(curChar)
{
case 110:
... | 9 |
private boolean jj_2_36(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_36(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(35, xla); }
} | 1 |
private void deleteFromPlaylist() {
try {
int songid;
int id;
showPlaylists();
System.out.println("Enter id of playlist to delete song from: ");
id = Keyboard.readInt();
getAllByPlaylist();
System.out.println("Enter id of song... | 1 |
public Configuration addClass(Class<?> entityClass) throws Exception {
int idCount = 0;
Entity entity = entityClass.getAnnotation(Entity.class);
if (entity == null)
throw new Exception("A classe " + entityClass + " não é uma entidade válida, pois não possui a anotação @Entity");
Field[] fields = entit... | 9 |
public static void main(String[] args) {
final Integer[] array = new Integer[2000000];
final Random random = new Random();
for (int i = 0; i < array.length; ++i) {
array[i] = random.nextInt(100);
}
final Map<String, Sorter> sorters = new LinkedHashMap<String, Sorter>();
sorters.put("Array... | 9 |
private void createFileMenu(Menu menuBar) {
//File menu.
MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
item.setText(resAddressBook.getString("File_menu_title"));
Menu menu = new Menu(shell, SWT.DROP_DOWN);
item.setMenu(menu);
/**
* Adds a listener to handle enabling and disabling
* some items in the E... | 4 |
@Override
public int smarts(Algebra algebra) {
Fraction frac = (Fraction) algebra;
if(frac.isSimplified()) return 0;
//if the bottom is 1 or -1 we can simplify for sure
else if(frac.getBottom().equals(Number.ONE) || frac.getBottom().equals(Number.NEGATIVE_ONE)) return 7;
else if(!frac.getTop().sign() || !fra... | 7 |
private void onPause() {
if (!downloadsTable.getSelectionModel().isSelectionEmpty()) {
int id = downloadsTable.convertRowIndexToModel(downloadsTable.getSelectedRow());
Integer gid = (Integer) downloadsTable.getModel().getValueAt(id, 0);
downloadManager.pauseDownload(gid);
... | 1 |
@Override
public void keyPressed(KeyEvent arg0) {
int keyCode = arg0.getKeyCode();
switch( keyCode )
{
case KeyEvent.VK_ESCAPE:
Fullscreen.this.dispose();
break;
case KeyEvent.VK_UP:
next();
break;
case KeyEvent.VK_DOWN:
back();... | 5 |
public LoggerStatus log(InputStream xliff, String filename,LoggerJena loggerJena) {
LoggerStatus results = new LoggerStatus();
try {
// Parse the xliff into an XML DOM
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(t... | 3 |
public void viewImage() {
try {
printCommandSeparator();
String infile = inputfiletxt.getText();
if (infile.toLowerCase().endsWith(".bmp")) {
BmpImage img = new BmpImage(infile);
bcifViewer.main(img, (new File(infile)).getName());
} else if (infile.toLowerCase().matches(".*\\.bcif[0-9]*")) {
if (str... | 9 |
public Date execute() throws IOException, ParseException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
boolean gotCorrect = false;
while(!gotCorrect){
try{
System.out.println("Introduzca una fecha (dd-mm-yyyy)");
String... | 2 |
protected void handleCommand(Player sender, String[] names)
{
Zone zone = executor.plugin.getSelectedZone(sender);
if (zone == null)
{
sender.sendMessage("[InvisibleWalls] Please select an zone first. (Use: /iw select <zoneId>)");
return;
}
StringBuilder str = new StringBuilder();
for (String s : ... | 6 |
private boolean saveUser(ArrayList<Machine> machines) {
String firstName = firstNameField.getText();
String lastName = lastNameField.getText();
String cwid = userIDField.getText();
String email = emailField.getText();
String department = departField.getText();
SystemAdministrator admin = ((SystemAdministra... | 9 |
public void mouseClicked(MouseEvent e)
{
} | 0 |
public static void main(String args[]){
Driver d=new Driver(true);
d.htmlContent("prod");
} | 0 |
private int setStatus(){
if(status.equals("Offline")){
statusID = 0;
return statusID;
}
if(status.equals("Available")){
statusID = 1;
return statusID;
}
if(status.equals("Maintenance")){
statusID = 2;
return statusID;
}
statusID = 3;
return statusID;
} | 3 |
public static boolean chequearActualizacion(String textoJSON) {
boolean resultado = false;
JSONParser parser = new JSONParser();
try {
Object objeto = parser.parse(textoJSON);
JSONObject objetoJSON = (JSONObject) objeto;
resultado = objetoJSON.containsKey(CANTFILAS);
} catch (ParseException e) {
e.p... | 1 |
private void init() {
setFont(APP_FONT);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent evt) {
if(SwingUtilities.isLeftMouseButton(evt) && evt.getClickCount() == 2 && mouseDoubleClick != null) {
int index = locationToIndex(evt.getPoint());
if(index == -1) {
... | 5 |
@Override
public int hashCode() {
int hash = 5;
hash = 97 * hash + ( ( this.id != null )
? this.id.hashCode()
: 0 );
hash = 97 * hash + ( ( this.title != null )
? this.title.hashCode()
: 0 );
hash = 97 * hash + ( ( this... | 7 |
public String getDefaultName() {
if (elementType instanceof ArrayType)
return elementType.getDefaultName();
return pluralize(elementType.getDefaultName());
} | 1 |
public ArrayList<Ticket> createTicketArrayListByWorker(int workerId) {
ArrayList<Ticket> result = new ArrayList<Ticket>();
ResultSet rs = null;
PreparedStatement statement = null;
try {
statement = conn.prepareStatement("select * from Tickets where WorkerID_FK=?");
statement.setInt(1, workerId);
... | 6 |
public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] var1, int var2, int var3, int var4, int var5) {
if(var1 == null || var1.length < var4 * var5) {
var1 = new BiomeGenBase[var4 * var5];
}
this.temperature = this.field_4194_e.func_4112_a(this.temperature, (double)var2, (double)var3, v... | 8 |
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int cpu_number;
int your_number;
String continuation = "Y";
int correct = 0;
int gameplays = 1;
int[] cpu_numbers = new int[100];
int[] your_numbers = new int[100];
System.out.println("Welcome to the Guess the Dice Ga... | 9 |
private void KDistanceFromRootRec(BTPosition<T> current, int k) {
if (current == null)
return;
if (k == 0) {
System.out.println("find one at " + current.element());
} else {
KDistanceFromRootRec(current.getLeft(), k - 1);// note: can't use
// --k here, it will
// affect the... | 2 |
private void doOutputCommand(Command command, HackSimulator simulator) throws ControllerException, VariableException {
if (output == null)
throw new ControllerException("No output file specified");
StringBuffer line = new StringBuffer("|");
for (int i = 0; i < varList.length; i++) ... | 9 |
private Node parseFactor(final Node parent) throws SyntaxException, IOException {
if (scanner.getCurrentToken().isType(TokenType.IDENTIFIER)) {
return IdentifierNode.newInstance(parent, scanner.getCurrentToken().getValue());
}
if (scanner.getCurrentToken().isType(TokenType.LITERAL))... | 9 |
private double exptGreaterThan(double b) {
double sum=0,interval=(bowSize*12-b)/1000,val=b;
for (int i = 0; i <1000; i++) {
sum+=phi(val, mu, sigma)*val*interval;
val+=interval;
}
return sum/(1-probLessThan(b));
} | 1 |
public static void main(String[] args) throws NumberFormatException, IOException {
InputStream inputStream = Googlers.class.getResourceAsStream("B-large-practice.in");
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader br = new BufferedReader(inputStreamReader);
int numCase... | 1 |
public ImageType classify() {
List<String> frameAsJPEG = getImagesFromVideo();
Map<ImageType, Integer> maxImageTypeForFrames = new HashMap<ImageType, Integer>();
ImageClassification imageClassifier = ImageClassification.getInstance();
for(String filePath : frameAsJPEG) {
Path jpegImagePath = Paths.get(filePa... | 5 |
private ArrayList<Word> getWords(Square square)
{
ArrayList<Word> words = new ArrayList<Word>();
Word word = new Word();
Word verticalWord;
int x = square.getX();
while(x < Board.SIZE - 1 && this.board[x][square.getY()].getTile() != null)
{
if((verticalWord = getVeticalWord(this.board[x][square.ge... | 8 |
@Override
public void actionPerformed(ActionEvent e) {
final String source = e.getActionCommand();
switch (source) {
case "Easy":
App.getField().setDifficulty(0);
break;
case "Medium":
App.getField().setDifficulty(1);
... | 6 |
public void setAddress(String address) {
this.address = address;
} | 0 |
@Override
public VoiceStatus[] getVoiceStatus() {
VoiceStatus[] all;
if (theSynths.size() == 1)
all = theSynths.get(0).getVoiceStatus();
else {
all = new VoiceStatus[0];
for (Synthesizer s : theSynths) {
VoiceStatus[] temp = s.getVoiceStatu... | 4 |
public void process(JCas arg0, ResultSpecification arg1) throws AnnotatorProcessException
{
System.out.println("Analysis engine 1");
String docText = arg0.getDocumentText();
String[] lines=docText.split("\n");
//Add LingPipe annotation
//Line commented for release
//File modelFile = new File("src/main/... | 8 |
public void convert(CharChunk cc, ByteChunk bc)
throws IOException {
if ((bb == null) || (bb.array() != bc.getBuffer())) {
// Create a new byte buffer if anything changed
bb = ByteBuffer.wrap(bc.getBuffer(), bc.getEnd(),
bc.getBuffer().length - bc.getEnd());
... | 8 |
public void setVis_matricule(String vis_matricule) {
this.vis_matricule = vis_matricule;
} | 0 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Alustetaan muuuttujat ja oliot sek� vastaan otetaan muuttujille arvot formilta
String poistettavaID = request.getParameter("ID");
TuoteFormBean tuoteForm = null;
try {
tuoteFor... | 4 |
public static List<ColumnMetaData> getColumnMetaData(final String key, final MetaData columnMD) {
if (key == null || key.equals(FPConstants.DETAIL_ID) || key.equals(FPConstants.COL_IDX)) {
return columnMD.getColumnsNames();
}
return columnMD.getListColumnsForRecord(key);
} | 3 |
* @return Returns true if the label of the given cell is movable.
*/
public boolean isLabelMovable(Object cell)
{
return !isCellLocked(cell)
&& ((model.isEdge(cell) && isEdgeLabelsMovable()) || (model
.isVertex(cell) && isVertexLabelsMovable()));
} | 4 |
public void loginUser(String user, String pass) {
int cond=0;
if (user.equals("") || pass.equals("")){
System.out.println("No Ha ingresado Usuario y/o contraseña...");
//cond=1;
//return false;
resultado = false;
} else {
... | 6 |
public static void main(String[] args) {
MNA mna = new MNA();
MNA.A mnaa = mna.new A();
MNA.A.B mnaab = mnaa.new B();
mnaab.h();
} | 0 |
public static int downloadInstalledLibraries(String jsonMarker, File librariesDir, IMonitor monitor, List<JsonNode> libraries, int progress, List<String> grabbed, List<String> bad) {
for (JsonNode library : libraries) {
String libName = library.getStringValue("name");
monitor.setNote(Str... | 6 |
@Override
public String findById(int id) {
String type = null;
try {
connection = getConnection();
ptmt = connection.prepareStatement("SELECT id FROM Task WHERE type=?;");
ptmt.setInt(1, id);
resultSet = ptmt.executeQuery();
resultSet.next(... | 5 |
private void clearResource(Hashtable resource){
if (resource != null){
Set keys = resource.keySet();
Object value;
for (Object key : keys){
value = resource.get(key);
if (value instanceof Reference){
library.removeObject((Re... | 3 |
public void addResource(int amount, Resource res) {
String r = res.toString();
if (amount <= 0) {
System.out.println("Cannot add negative resources");
return;
}
if (r.equals("Metal")) {
Metal += amount;
return;
}if (r.equals("Wood")) {
Wood += amount;
return;
}if (r.equals("Food")) {
Fo... | 6 |
@Override
public void render (float delta) {
badguy.setGoal(missile.getBody().getPosition());
badguy.update(delta);
missile.update(delta);
String newLine = System.lineSeparator();
if(countdown.isDone()){
System.out.println("You didn't manage to destroy the enemy ship, " + newLine + " they fled and de... | 4 |
public void grow(double dw, double dh)
{
if (x1 <= x2)
{
x1 -= dw;
x2 += dw;
}
else
{
x1 += dw;
x2 -= dw;
}
if (y1 <= y2)
{
y1 -= dh;
y2 += dh;
}
else
{
... | 2 |
public void render(Entity parent, Graphics g, int delta) {
if (this.shown) {
// if the text is dynamic, move the text at its y location (decrement by speed)
if (this.dynamic) {
this.speed -= 0.05f;
this.y -= this.speed;
if (this.speed <= 0) this.shown = false; // if the speed equals to ... | 5 |
public static boolean shouldBuild() {
// =========================================================
// Begin EASY-WAY
int factories = TerranFactory.getNumberOfUnitsCompleted();
int vultures = TerranVulture.getNumberOfUnits();
if (vultures < TerranVulture.CRITICALLY_FEW_VULTURES && !TerranVulture.DISABLE_VULT... | 5 |
public Item getItem(int itemSlot)
{
if(itemSlot > 5 || itemSlot < 0)
return null;
Item item = inv[itemSlot];
return item;
} | 2 |
public void setAutopaint(boolean autopaint) {
if (this.autopaint == autopaint)
return;
this.autopaint = autopaint;
if (autopaint)
forceRedraw();
} | 2 |
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException {
try {
resp.setContentType("text/plain");
PrintWriter out = resp.getWriter();
out.println("*** ApacheDS RootDSE ***\n");
DirContext ctx = new InitialDirContext(this.createEnv());
SearchControls ctls =... | 4 |
public Collection implementors(final Type type) {
final TypeNode node = getImplementsNode(type);
if (node != null) {
final List list = new ArrayList(implementsGraph.preds(node));
final ListIterator iter = list.listIterator();
while (iter.hasNext()) {
final TypeNode v = (TypeNode) iter.next();
it... | 2 |
private int updateCellCount(int current, int count) {
if(count == 0) {
if(current == 1) {
return -1;
}
if(current == 2) {
return 1;
}
} else {
if(count < 0) {
if(current == 1) {
return count-1;
}
if(current == 2) {
... | 9 |
public OrderSet<? super PROJECTION> removeLast()
{
if(orders.size() > 1)
{
return new OrderSet<PROJECTION>(orders.subList(0, orders.size()-1));
}
else
{
return new OrderSet<PROJECTION>(new ArrayList<Order<? super PROJECTION>>());
}
} | 3 |
private static boolean isValidScheme(final String scheme) {
final int length = scheme.length();
if (length < 1) {
return false;
}
char c = scheme.charAt(0);
if (!Character.isLetter(c)) {
return false;
}
for (int i = 1; i < length; i++) {
... | 7 |
public void setFossil(String value) {
this.fossil = value;
} | 0 |
@Override
public boolean equals(Object obj) {
if (obj instanceof Link) {
return this.getLinkID() == ((Link) obj).getLinkID();
}
return false;
} | 1 |
private int countNeighbours(int line, int row) {
int count = 0;
for(int lineOffset=-1; lineOffset <=1; lineOffset++) {
int lineIndex = line+lineOffset;
if(lineIndex <0 || lineIndex >= states.length) continue;
for(int rowOffset=-1; rowOffset <=1; rowOffset++) {
if(lineOffset==0 && rowOffset==0) ... | 9 |
private void computeWeightedShortestPath(Vertex origin)
{
// priority queue to store paths that need to be visited
PriorityQueue pq = new PriorityQueue(PriorityQueue.PRIORITY_ASCENDING);
// number of vertices visited
int visited;
// current shortest path
Path shortestPath;
// Vertex in current s... | 6 |
public static void server(int port) throws IOException, InterruptedException{
ServerSocket server = new ServerSocket(port);
Socket socket;
while (true){
socket = server.accept();
System.out.println(socket.getRemoteSocketAddress().toString() + " connected... | 9 |
@Override
public boolean isDuplicate(Question obj) {
for (Question q : questions) {
if (q.equals(obj)) {
return true;
}
}
if (questions.size() >= limit) {
questions.remove(0);
}
questions.add(obj);
return false;
... | 3 |
public void computeChoice (int ART_MODE) {
double top, bottom;
if (ART_MODE == FUZZYART) {
// System.out.println("Phase code T computationation FUZZYART");
for (int j=0; j<numCode; j++) {
activityF2[j] = 0;
top = 0;
bottom = alpha;
for (int k... | 8 |
public void drawVillage(Graphics2D gI)
{
gI.drawImage(village.draw((int)(getX()-village.getX()+village.getRelativeChunkCenter().getX()), (int)(getY()-village.getY()+village.getRelativeChunkCenter().getY())), 0, 0, Chunk.getPixelLength(), Chunk.getPixelLength(), null);
} | 0 |
public void setSpecificTrainerImages()
{
if(name.equals("James"))
{
for(int i=0; i<4; i++)
{
URL url=Trainer.class.getResource("Sprites/OverworldNPCs/prof"+i+".png");
trainerStand[i]=Toolkit.getDefaultToolkit().getImage(url);
}
}
else if(name.equals("Jimmy")||name.equals("Jac... | 7 |
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.