text stringlengths 14 410k | label int32 0 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 and feel.
* For details see http://down... | 6 |
public void testForStyle_stringLengths() {
try {
DateTimeFormat.forStyle(null);
fail();
} catch (IllegalArgumentException ex) {}
try {
DateTimeFormat.forStyle("");
fail();
} catch (IllegalArgumentException ex) {}
try {
D... | 4 |
public boolean wordBreak2(String s, Set<String> wordDict) {
int n = s.length();
if (n < 1) return false;
// T[i][j] == true iff s[i..j] is segmentable
boolean[][] seg = new boolean[n][n];
for (int l=0; l<n; ++l) { // segment length, seg[i,i] has length of 0.
for (int i=0; i<n-l; ++i) { // start... | 7 |
private void onPowerOn(){
startRun_enabled = false;
stopRun_enabled = false;
postApp_enabled = true;
resetSDSU_enabled = true;
resetPCI_enabled = false;
setupServer_enabled = false;
powerOn_enabled = false;
powerOff_enabled = true;
logPanel.add("Powered on... | 5 |
private HttpResponse send(String urlString, String method,
Map<String, String> parameters, Map<String, String> propertys)
throws IOException {
HttpURLConnection urlConnection = null;
if (method.equalsIgnoreCase("GET") && parameters != null) {
StringBuffer param = new... | 9 |
public boolean setUserlistImageFrameHeight(int height) {
boolean ret = true;
if (height <= 0) {
this.userlistImgFrame_Height = UISizeInits.USERLIST_IMAGEFRAME.getHeight();
ret = false;
} else {
this.userlistImgFrame_Height = height;
}
setUse... | 1 |
public boolean shouldExecute()
{
if (!this.theEntity.isCollidedHorizontally)
{
return false;
}
else
{
PathNavigate var1 = this.theEntity.getNavigator();
PathEntity var2 = var1.getPath();
if (var2 != null && !var2.isFinished() &... | 7 |
public void loadBackup(Backup bk, boolean userLoaded){
if (!userLoaded)
DB = bk.getPath() + File.separator + DB_NAME;
else
DB = bk.getPath();
dblite = new SQLiteConnection(new File(DB));
} | 1 |
protected void initStatistics(String html) {
//create stats
if(generateStatistics) {
statistics = new HtmlCompressorStatistics();
statistics.setTime((new Date()).getTime());
statistics.getOriginalMetrics().setFilesize(html.length());
//calculate number of empty chars
Matcher matcher = emptyPatter... | 2 |
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 static void main(String[] args)
{
long startTime = System.currentTimeMillis();
if(args.length == 0){
System.out.println("Please provide the location of the workload file!");
System.exit(1);
}
try {
String fileName = args[0];
... | 3 |
public int login(String uname, String pword) throws Throwable {
md5 enc = new md5();
SQLite_helper log = new SQLite_helper();
ResultSet user = log.retrieve("users","username", uname);
if(!user.next()) {
return 0;
} else {
String username = user.getString("username");
if(username.compareTo(uname) == 0... | 4 |
private static void bfsRec(mxAnalysisGraph aGraph, Set<Object> queued, LinkedList<Object[]> queue, mxICellVisitor visitor)
{
if (queue.size() > 0)
{
Object[] q = queue.removeFirst();
Object cell = q[0];
Object incomingEdge = q[1];
visitor.visit(cell, incomingEdge);
final Object[] edges = aGraph.ge... | 3 |
private ServerInfo getServer( InetSocketAddress inetSocketAddress ) {
for ( ServerInfo s : ProxyServer.getInstance().getServers().values() ) {
if ( s.getAddress().equals( inetSocketAddress ) ) {
return s;
}
}
return null;
} | 2 |
protected void ensureExists(int firstKey, int secondKey) {
ConcurrentHashMap<Integer, Object> map = distrLocks.get(firstKey);
if (map == null) {
ConcurrentHashMap<Integer, Object> new_map = new ConcurrentHashMap<Integer, Object>();
map = distrLocks.putIfAbsent(firstKey, new_map);... | 6 |
public void init() {
if (user == null && userId!=0) {
user = userService.findUser(userId);
} else if (user == null && userId==0) {
user = new User();
}
if (user == null) {
try {
FacesContext.getCurrentInstance().getExternalContext().red... | 6 |
public String addBinary_2(String a, String b) {
StringBuffer res = new StringBuffer();
int m = a.length();
int n = b.length();
int carry = 0;
for (int i = 0; !(i>=m && i>=n); ++i){ // stop when i >= m && i >= n
int tmp = 0;
if (i >= m) {
tmp... | 5 |
protected static boolean checkResource(Resource resource) {
boolean isValid;
if (isValid = resource != null) {
isValid = TYPES.contains(resource.getType());
isValid = isValid && resource.getProperty(URL_PROPERTY) != null;
isValid = isValid && resource.getProperty(USER... | 5 |
public void actionPerformed(ActionEvent event){
if(event.getSource()==submitButton){
String userId=textBox.getText();
if(!userId.equals("")){
textBox.setText("");
ut = new TwitterAnalysis();
ut.analyze(userId);
int i,num=UserTopTenTweets.tw.size();
for(i=0;i<10;i++){
... | 7 |
private boolean download(String link, File output) {
InputStream in = null;
FileOutputStream out = null;
try {
URL url = new URL(link);
in = url.openStream();
out = new FileOutputStream(output);
byte[] buffer = new byte[1024];
while (in... | 6 |
public Record updateRecord(Record record){
for(Record r:table){
if(r.getUsername().compareToIgnoreCase(record.getUsername())==0){
r.setSessionKey(record.getSessionKey());
r.setTimeStamp(record.getTimeStamp());
}
}
return null;
} | 2 |
public void createScreenShot()
{
File screenshotFile = null;
JFileChooser chooser = new JFileChooser();
UIManager.put("FileChooser.saveDialogTitleText", "Save Michelizer Screenshot");
SwingUtilities.updateComponentTreeUI(chooser);
chooser.setSelectedFile(new File("Michelizer_Output.jpg"));
screenshotFile ... | 5 |
private void initAStar(List<Scenery> opened, Scenery startingScenery) {
Set<Scenery> adjacencies = new HashSet<Scenery>();
adjacencies = getAdjacencies(startingScenery);
for (Scenery adjacency : adjacencies) {
adjacency.setParent(startingScenery);
if (!adjacency.equals(startingScenery) && adjac... | 4 |
public void paint(Graphics g) {
super.paint(g);
if (ingame) {
Graphics2D g2d = (Graphics2D)g;
if (craft.isVisible())
g2d.drawImage(craft.getImage(), craft.getX(), craft.getY(),
this);
ArrayList ms = craft.getMissiles()... | 5 |
public void listCleanUp(){
for(int i = 0; i < collisionList.size(); i++){
if(collisionList.get(i).isDead()){
collisionList.remove(i);
}
}
for(int i = 0; i < paintList.size(); i++){
if(paintList.get(i).isDead()){
paintList.remove(i);
}
}
} | 4 |
public List<List<Double>> getRankNormalizedDataPoints()
{
List<List<Double>> rankList = new ArrayList<List<Double>>();
for( int x=0; x < getSampleNames().size(); x++)
{
List<RankHolder> innerRanks = new ArrayList<RankHolder>();
for( int y=0; y < getOtuNames().size(); y++ )
{
RankHolder rh = n... | 6 |
public boolean create(final Player player, final Sign state) {
final Function function = this.getFunction(state);
if (function == null) {
Main.courier.send(player, "messages.unknownFunction", state.getLine(1));
return false;
}
if (!function.canApply(player)) {
... | 3 |
private String escapeString(String s) {
StringBuffer stringBuffer = new StringBuffer();
char backslash = '\\';
char previousChar = 0;
char ch = 0;
for (int i = 0; i < s.length(); i++) {
previousChar = ch;
ch = s.charAt(i);
if (ch == '\\') {
//stringBuffer.append("\\\\... | 4 |
public static int discrete(double[] a) {
double EPSILON = 1E-14;
double sum = 0.0;
for (int i = 0; i < a.length; i++) {
if (a[i] < 0.0) throw new IllegalArgumentException("array entry " + i + " is negative: " + a[i]);
sum = sum + a[i];
}
if (sum > 1.0 + EP... | 7 |
public Type createRangeType(ReferenceType bottom) {
/*
* tArray(y), tArray(x) -> tArray( y.intersection(x) ) obj , tArray(x)
* -> <obj, tArray(x)> iff tArray extends and implements obj
*/
if (bottom.getTypeCode() == TC_ARRAY)
return tArray(elementType
.intersection(((ArrayType) bottom).elementType)... | 4 |
public boolean add(Row row) {
Boolean bool = true;
for (Row r : this) {
for (int i = 0; i < r.size(); i++) {
if (!r.get(i).equals(row.get(i))) {
break;
}
if (i == r.size() - 1) {
bool = false;
... | 5 |
@Override
public boolean matches(String inputExt, String outputExt) {
return StringUtils.equalsIgnoreCase(inputExt, "properties") && StringUtils.endsWithIgnoreCase(outputExt, "xls");
} | 1 |
public void actionPerformed(ActionEvent e) {
final Page p = (Page) getTextComponent(e);
Element[] elem = p.getSelectedParagraphs();
if (elem == null)
return;
float currentIndent = 0.0f;
AttributeSet as = null;
StyledDocument doc = p.getStyledDocument();
Element head = null;
Icon icon = null;
fo... | 8 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public void removerUsuario(){
if ( this.num_usuarios == 0 ) System.out.println("\nNão existem "
+ "usuários.");
else{
System.out.println("\nQual dos usuários você gostaria de remover? "
+ "[ 1 - " + this.num_usuarios + " ]" );
int i = 1;
... | 9 |
@Override
public List<Rule> getRulesForLhs(List<Specie> species) {
List<Rule> affectingLHSRules = new ArrayList<Rule>();
for (Rule rule : rules) {
for (Specie specie : species) {
if (!rule.getLhs().contains(specie)) {
break;
}
affectingLHSRules.add(rule);
}
}
return affectingLHSRules;
} | 3 |
static private double getBaseValue(Converter[] u, String n){
int i=0;
while (i < u.length
&& !u[i].abrv.equalsIgnoreCase(n)
&& !u[i].unit.equalsIgnoreCase(n)) {
i++;
}
if (i >= u.length)
return 1;
else
return u[i].toBase;
} | 4 |
public double[] getCalibrationData() {
if (calibrationType == MEAN) {
double[] meanArray = new double[1];
meanArray[0] = mean;
return meanArray;
} else {
double[] calibrationData = new double[calibrationDataSize];
int index = 0;
for... | 3 |
public void sortiere( int[] zahlen, int l, int r ) {
setRekursionen( getRekursionen() + 1 );
int positionLinks = l;
int positionRechts = r;
/*
* Sortierung von der Mitte aus starten, Pivotzahl finden
*/
int pivot = zahlen[ ( l + r ) / 2 ];
/*
* solange sie sich noch nicht getroffen haben
*/
... | 6 |
public int getS1() {
return this.state;
} | 0 |
public MCDObjet getElement(String name) {
for (Iterator<ZElement> e = enumElements(); e.hasNext();) {
MCDObjet o = (MCDObjet) e.next();
if (o.getName().equals(name))
return o;
}
return null;
} | 2 |
public String getContrindic() {
return contrindic;
} | 0 |
void doReceive(final File file, final boolean resume) {
new Thread() {
public void run() {
BufferedOutputStream foutput = null;
Exception exception = null;
try {
// Convert the integer addr... | 3 |
public ArrayList<Coordinate> getAvailableMoves (){
if (m_test){
System.out.println("AIEasy.getAvailableMoves- begin");
}
ArrayList<Coordinate> a = new ArrayList <Coordinate> ();
for (int x=0; x<getGame().getGrid().getGridWidth();x++){
for (int y=0; y<getG... | 5 |
public T read (Kryo kryo, Input input, Class<T> type) {
T object = kryo.newInstance(type);
kryo.reference(object);
for (int i = 0, n = properties.length; i < n; i++) {
CachedProperty property = properties[i];
try {
if (TRACE) trace("kryo", "Read property: " + property + " (" + object.getClass() + ")");
... | 7 |
private Cell[][] getSeats(boolean priority) {
ArrayList<ArrayList<Cell>> seats = new ArrayList<>();
for (Cell[] row : this.planeSeats) {
ArrayList<Cell> rowSeats = new ArrayList<>();
for (Cell cell : row) {
if (priority && cell.getCellType() == CellType.PRIORITY... | 8 |
synchronized boolean resetMessageQueue(String statusList) {
boolean isRemove = (statusList.length() > 0 && statusList.charAt(0) == '-');
boolean isAdd = (statusList.length() > 0 && statusList.charAt(0) == '+');
String oldList = this.statusList;
if (isRemove) {
this.statusList = viewer.simpleReplace(oldList, ... | 7 |
@SuppressWarnings("unchecked")
public void saveError(HttpServletRequest request, String error) {
List errors = (List) request.getSession().getAttribute(ERRORS_KEY);
if (errors == null) {
errors = new ArrayList();
}
errors.add(error);
request.getSession().setAttrib... | 1 |
private static void showRoundBorder(String worldName, BorderData border)
{
if (squareBorders.containsKey(worldName))
removeBorder(worldName);
CircleMarker marker = roundBorders.get(worldName);
if (marker == null)
{
marker = markSet.createCircleMarker("worldborder_"+worldName, Config.DynmapMessage(), fal... | 2 |
static int mcCarthy91(int n){
if(n > 100){
System.out.println(n);
return n-10;
} else {
System.out.println(n);
return mcCarthy91(mcCarthy91(n+11));
}
} | 1 |
public byte[] encrypt(byte[] text, String key){
// System.out.println("encrypting");
byte[] textEncrypted = null;
try{
//keygenerator.init(bits); // 192 and bits bits may not be available
byte[] keyPadded = new byte[bits / 8];
for(int i = 0; i < bits / 8 && i < key.length(); i++){
keyPadded[i] = ... | 7 |
private void connectBackupServer() {
try {
if(secondary)
backupServer = (ServerInterface) Naming.lookup("rmi://127.0.0.1:9090/server1");
else
backupServer = (ServerInterface) Naming.lookup("rmi://127.0.0.2:9090/server2");
backupServer.ping();
} catch(Exception ex) {
resetBackupServer();
}
} | 2 |
public Object readBeanConnection(Element node) throws Exception {
Object result;
Vector children;
Element child;
String name;
int i;
int source;
int target;
int ... | 7 |
private static void addConstructedProblemReports(
Model cm,
List<ConstraintViolation> results,
Model model,
Resource atClass,
Resource matchRoot,
String label,
Resource source, SPINModuleRegistry registry) {
StmtIterator it = cm.listStatements(null, RDF.type, SPIN.ConstraintViolation);
while(... | 8 |
int getLineWidth() {
int lineWidth = 0;
if (_endnoteMode && paragraphOn) {
lineWidth = endTextWidth - endParInd - endInd;
} else if (_endnoteMode && !paragraphOn) {
lineWidth = endTextWidth - endInd;
} else if (!_endnoteMode && paragraphOn) {
lineWidth... | 8 |
public boolean equals(Object o){
if(o == this || o == mKey) return true;
return mKey.equals(o);
} | 2 |
public void rajayta(int x, int y) {
if(this.panoksia > 0) {
this.panoksia--;
} else {
return;
}
int vaikutusalue = this.rajahdysainetta / 33;
int rajahdysalue = this.rajahdysainetta / 100;
for (Ruutu ruutu : this.kentta.getRuudu... | 9 |
public synchronized boolean hasMoreSteps()
{
if(worker == null || excepted || !worker.isAlive() ) return false;
try
{
while (!halted) this.wait();
// This is a difficult piece of code.
// We halt if there is an exception, this is the easy part.
... | 8 |
public int get_bits(int number_of_bits)
{
int returnvalue = 0;
int sum = bitindex + number_of_bits;
// E.B
// There is a problem here, wordpointer could be -1 ?!
if (wordpointer < 0) wordpointer = 0;
// E.B : End.
if (sum <= 32)
{
// all bits contained in *wordpointer
returnvalue... | 3 |
public static final String wasWere(int amount) {
return amount == 1 ? WAS : WERE;
} | 1 |
@Override
public boolean equals(Object o) {
if(o instanceof SimpleHashSet) {
if((this.size() == ((SimpleHashSet<?>)o).size())) {
int count = 0;
Iterator<?> it = ((SimpleHashSet<?>)o).iterator();
while(it.hasNext()) {
if(this.con... | 8 |
public static void handle(String[] tokens, Client client) {
if (tokens[1].equals("login")) {
client.send(PacketCreator
.openURL(
"http://www2.knuddels.de/dprint/dprint.pl?jig=4&domain=Knuddels.de",
"_blank"));
}
} | 1 |
@Override
public void run(MappedLEDPhidget ledPhidget) {
snake.clear();
// all off
for (int i = 0; i < 64; i ++) {
ledPhidget.setBrightness(i, 0);
}
for (int i = 0; i < 20; i+= 2) {
addLight(ledPhidget, i);
}
for (int i = 19; i >= 1; i-... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EssensAuswahl other = (EssensAuswahl) obj;
if (auswahl == null) {
if (other.auswahl != null)
return false;
} else if (!auswahl.equals(ot... | 9 |
public static ArrayList<TestQuestionBean> updateTestQuestion2(String testid){
ArrayList<TestQuestionBean> a=new ArrayList<TestQuestionBean>();
try{
con=DBConnection.getConnection();
st=con.createStatement();
ResultSet rs=st.executeQuery("select category from test where testid='"+testid+"'");
String cate... | 3 |
public void startSimulation() {
if (!isActive) {
isActive = true;
// If physics thread is not null it never actually stopped.
if (physicsThread == null) {
physicsThread = new Thread(physicsLoop);
physicsThread.start();
}
}
} | 2 |
public void hello() {
String str;
System.out.println();
System.out.println("***************************************************************");
System.out.println("* *");
System.out.println("* ... | 5 |
public void initialise(World world) throws PatternFormatException
{
String[] cellParts = cells.split(" ");
for (int i=0;i<cellParts.length;i++)
{
char[] currCells = cellParts[i].toCharArray();
for (int j=0;j<currCells.length;j++)
{
if (currCells[j] != '1' && currCells[j] != '0') ... | 5 |
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String action = request.getParameter("act");
if(action != null) {
try {
RequestContext context = new RequestContext(request);
if(context.isLogged(... | 8 |
public static void printRelationship(String file, String [] relations) {
BufferedWriter output;
FileWriter streamFiles;
try {
streamFiles = new FileWriter(file, true);
output = new BufferedWriter(streamFiles);
if(ReadFromFile.getNumberFromFile(file) < 2) {
for(int i = 0; i < relations.length; i++) {
... | 7 |
private boolean isNotPassable(Map map, Snake[] snakes, int x, int y) {
if (!map.passable(x, y)) {
return true;
}
for (Snake s : snakes) {
if (s.cellAt(x, y) != -1) {
return true;
}
}
return false;
} | 3 |
public String getQuote()
{
String finalString = "";
finalString += this.companyName;
finalString += " (";
finalString += this.symbol;
finalString += ")\nPrice: ";
finalString += this.lastPrice;
finalString += " hi: ";
finalString += this.highPrice;
finalString += " lo: ";
finalString += this.low... | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Position other = (Position) obj;
if (xPos == null) {
if (other.xPos != null)
return false;
} else if (!xPos.equals(other.xPos))
retur... | 9 |
public int chooseTurnHandler() {
if (!homing) {
return chooseTurnForGoal();
} else {
return chooseTurnReturn();
}
} | 1 |
private void drawLayer(Graphics g, CPLayer layer, boolean selected) {
Dimension d = getSize();
if (selected) {
g.setColor(new Color(0xB0B0C0));
} else {
g.setColor(Color.white);
}
g.fillRect(0, 0, d.width, layerH);
g.setColor(Color.black);
g.drawLine(0, 0, d.width, 0);
g.drawLine(eyeW, ... | 2 |
@Override
public void prepareSpecificMenu() {
menuPanel.setLayout(new GridLayout(100, 1, 0, 30));
JButton start = new JButton("Continue");
start.setActionCommand(CMD_CONTINUE);
start.addActionListener(this);
menuPanel.add(start);
} | 0 |
@Test
public void testGetCirclePoints() {
Set<Point> r7Points = CircleAccumulator.getCirclePoints(7, 0, 0);
Set<Point> r8Points = CircleAccumulator.getCirclePoints(8, 0, 0);
assertTrue("getCirclePoints with r = 7 misses (5,5): " + r7Points, r7Points.contains(new Point(5, 5)));
assertFalse("getCirclePoints with... | 0 |
@Test
public void test6(){
Random r = new Random();
QuickSort qs = new QuickSort();
ArrayList<Integer> test = new ArrayList<Integer>();
int[] answer = new int[1000000];
int x = 0;
for(int i=0; i<1000000; i++)
{
x = r.nextInt(1000000);
test.add(x);
answer[i] = x;
}
test = qs.quickSort(test);
... | 2 |
public void computeDistanceDensities(double max_dist) {
int bin_num=100;
int testedSet=10000;
double bin_size=max_dist/(double)bin_num;
int[] dd=null;
System.out.println("Computing distance densities...");
DatasetObject[] objects=new DatasetObject[testedSet];
dd=n... | 6 |
private String getConfigString(String path) {
FileConfiguration config = this.getConfig();
String s = config.getString(path);
if (s != null) {
s = s.trim();
if (s.length() == 0)
s = null;
}
return s;
} | 2 |
public boolean notifyDataAvailable(AvailableData availableData, boolean lastData) {
List<Patient> patients = availableData.getPatients().getPatient();
for(int i = 0; i < patients.size(); i++){
Patient patient = patients.get(i);
System.out.println(patient.getName());
List<Study> studies = patient.getStudi... | 5 |
public float[] toRGB(float comp[]) {
if (comp.length==3) {
// compute r', g' and b' by raising the given values to the
// correct gamma
float a = (float)Math.pow(comp[0], gamma[0]);
float b = (float)Math.pow(comp[1], gamma[1]);
float c = (float)Math.pow(comp[2], gamma[2]);
... | 3 |
public void init() {
System.out.println("SHS Servlet: init()");
} | 0 |
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof DefaultHighLowDataset)) {
return false;
}
DefaultHighLowDataset that = (DefaultHighLowDataset) obj;
if (!this.seriesKey.equals(that.seriesKey))... | 9 |
@Override
public void fromMessage(Message message) throws JMSException {
this.setId(message.getStringProperty(Strings.ID));
} | 0 |
public void pointerDragged(int x, int y)
{
addPoint(x, y);
} | 0 |
public static String getHTTPTime(int days) {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
calendar.add(Calendar.DAY_OF_MONTH, ... | 0 |
public void setWindowPosition(Position position) {
if (position.equals(Position.NONE)) {
IllegalArgumentException iae = new IllegalArgumentException("Position none is not allowed!");
Main.handleUnhandableProblem(iae);
}
this.window_Position = position;
somethingC... | 1 |
public void setIdentifier(PIdentifier node)
{
if(this._identifier_ != null)
{
this._identifier_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node... | 3 |
private boolean containsCharacters(String n) {
boolean isCharacter = false;
String temp;
for (int i = 0; i < n.length(); i++) {
temp = n.substring(i, i + 1);
// checks to see if all characters are digits
if (!Character.isDigit(n.charAt(i)))
isCharacter = true;
// ensures than only numbers 1-5 ar... | 7 |
public void tampilkanDaftar(){
if (!daftarPembeli.isVisible()){
DaftarPembeli.listPembeli = pembeli.bacaDaftar();
daftarPembeli = new DaftarPembeli(null, true);
daftarPembeli.setVisible(true);
if (!DaftarPembeli.no_beliDipilih.equals("")) {
i... | 3 |
private void fruitDistToHtml(StringBuffer buf) {
// buf.append(" <div style=\"width: 800px; float: left;\">\n");
buf.append("<div>");
buf.append("<div style=\"width: 500px; height: 40px; text-align: center;font-size: 25px; font-weight: bold; font-family: 'Comic Sans MS', cursive, sans-serif\... | 4 |
private TVC[] copySetWithout(TVC withoutIt, TVC[] connections) throws CloneNotSupportedException {
TVC[] r = new TVC[connections.length - 1];
int idx = 0;
for (TVC c : connections) {
if (c != withoutIt) {
r[idx++] = c;
}
}
return r;
} | 2 |
public static void main(String args[]) throws IOException, ClassNotFoundException {
// arguments: input output
if (args.length != 2)
System.out.println("Usage: java sitg.tagging.PosTagger input output");
long start = System.currentTimeMillis();
System.out.println("Tagging TXT files...");
// Ini... | 7 |
public static void main(String[] args) {
for (Object o: System.getProperties().keySet()) {
System.out.printf("%s:%s\n",o.toString(),System.getProperty((String)o));
}
try {
File folder = new File("files");
for (File file : folder.listFiles()) {
if (file.getAbsolutePath().endsWith(".arff")) {
S... | 6 |
public ImperialSword(){
this.name = Constants.IMPERIAL_SWORD;
this.attackScore = 30;
this.attackSpeed = 20;
this.money = 4000;
} | 0 |
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
if (((Boolean) parent.getConfigu().getOpt(
Config.Option.PistonProtection)).booleanValue()) {
Block b = event.getBlock();
CBlock conBlock = parent.getCBlock(b.getLocatio... | 5 |
public Element removeElement(Point location) {
Element deleted = null;
for(Element element:elements) {
if(element.getLocation().equals(location)) {
deleted = element;
break;
}
}
if(deleted != null) {
bank.deposit(deleted.getType().getPrice());
elements.remove(deleted);
}
return deleted;
... | 3 |
public void move() {
Random generator = new Random();
int num1 = generator.nextInt(4);
if (num1 == 0) {
x -= 5;
y -= 5;
} else if (num1 == 1) {
x -= 5;
y += 5;
} else if (num1 == 2) {
x += 5;
y -= 5;
... | 7 |
public void paint(Graphics2D g2, TreePane treePane, Justification justification, Rectangle2D bounds) {
Font oldFont = g2.getFont();
Paint oldPaint = g2.getPaint();
Stroke oldStroke = g2.getStroke();
if (getBackground() != null) {
g2.setPaint(getBackground());
g2.... | 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.