text stringlengths 14 410k | label int32 0 9 |
|---|---|
public String toString()
{
String ret = new String("");
for(int y=tabuleiro[0].length-1; y>=0; y--)
{
if( y == tabuleiro[0].length-1 )
{
for(int x=0; x<tabuleiro.length; x++)
ret += " "+x;
ret += Util.EOL;
}
for(int x=0; x<tabuleiro.length; x++)
ret += "|"+tabuleiro[x][y];
ret ... | 5 |
@Override
public String toString() {
String txt = "";
if (label != null && !label.equals("")) {
txt += label + ": \n";
}
if (vertices != null && vertices.size() > 0) {
txt = txt + "V: {";
for (Vertex v : vertices) {
txt = txt + v.ge... | 8 |
@Override
public boolean equals(Object obj) {
if (!(obj instanceof TargetTransition))
return false;
TargetTransition tt = (TargetTransition) obj;
return this.action.equals(tt.action) && this.invoke.equals(tt.invoke);
} | 2 |
public static void linejnyj(int[] a,
int key) {
double time = -System.currentTimeMillis();
boolean flag = false;
for (int i = 0; i < a.length; i++) {
if (a[i] == key) {
System.out.println("pozicija " + (i + 1));
flag = true;
}
... | 3 |
public ArrayList<Term> getOverlappingTerms(String query, ArrayList<Integer> selectedChapters){
if(index.hasTerm(query)){
if(selectedChapters.size() == 0){
return index.getOverlappingTerms(query, 0, 0);
}
else {
ArrayList<Term> overlappingTerms = new ArrayList<>();
for(int i = 0;i < selectedChapte... | 5 |
@Override
public List<Position> getAll() throws SQLException {
List<Position> results = new ArrayList<Position>();
Connection dbConnection = null;
java.sql.Statement statement = null;
String selectCourses = "SELECT id_position, name, sallary FROM position";
try {
dbConnection = PSQL.getConnection();
st... | 4 |
public static void main(String[] args) {
long pathCount = 0;
long[][] grid = new long[xDim][yDim];
for(int i = 0; i < yDim; i++) {
for(int j = 0; j < xDim; j++) {
if(j == 0 && i == 0)
grid[j][i] = 1 + 1;
else if(j == 0)
grid[j][i] =... | 8 |
public String toString() {
return String.format("%2d : %s", getSuppliercode(), getName());
} | 0 |
@Override
public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
String cmd = splitted[0];
MapleCharacter pl = c.getPlayer();
if (cmd.equalsIgnoreCase("donated")) {
if (splitted.length != 4) {
pl.dropMessage("syntax : !donated... | 9 |
public void setChar(TChar node)
{
if(this._char_ != null)
{
this._char_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}... | 3 |
public Editor(final Skin skin) {
if (skin == null) {
throw new IllegalArgumentException();
}
this.skin = skin;
setUpStringArrays();
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
Editor.this.setTitle(GUI... | 1 |
private ItemStack createStack(Objective o, QuestProgress qd)
{
Material m = Material.getMaterial(o.getItemIconId());
if(m == null || m == Material.AIR)m = Material.getMaterial(o.getType().getItemIcon());
if(m == null || m == Material.AIR)m = Material.WRITTEN_BOOK;
ItemStack ostack = new ItemStack(m);
ItemMet... | 8 |
public String getXML() throws KettleException {
StringBuilder retval = new StringBuilder();
if (inputField != null) {
retval.append(" ").append(XMLHandler.addTagValue("INPUT_FIELD", inputField));
}
if (classpath != null) {
retval.append(" ").append(XMLHandler.openTag("CLASSPATH")).append(Const.CR);... | 6 |
public String scriptCreation(String appKey, String userKey, String testName) {
try {
appKey = URLEncoder.encode(appKey, "UTF-8");
userKey = URLEncoder.encode(userKey, "UTF-8");
testName = URLEncoder.encode(testName, "UTF-8");
} catch (UnsupportedEncodingException e) {... | 1 |
private boolean includes(HashMap<String, String> row,
HashMap<String, String> list) {
for (String key : list.keySet()) {
String correct = list.get(key);
String rowData = row.get(key);
if (!correct.equals(rowData))
return false;
}
return true;
} | 2 |
public void wakeUp(final Guard guard){
Thread clockTick = new Thread(){
private Bandit prey = null;
@Override
public void run(){
for(GameMatter itm: area.getItems()){
if(itm instanceof Bandit){
prey = (Bandit) itm;
}
}
try {
this.sleep(2500);
} catch (InterruptedExcepti... | 5 |
public Object getObject(String name) {
try {
return lookupObject(name);
}
catch (ObjectNotFoundException e) {
return null;
}
} | 1 |
public final synchronized void waitForInit() {
if (--this.wait <= 0) {
return;
}
while (this.wait != 0) {
try {
wait();
} catch (final InterruptedException e) {
this.master.interrupt();
}
}
} | 3 |
@EventHandler
public void WitchNightVision(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.NightV... | 6 |
public void showPhoneNumberPopup() {
phoneNumber.show();
} | 0 |
public void addLink(int s, int d){
Node S = null;
Node P = null;
for(Node N : network)
{
if(N.id == s)
{
S = N;
}
if(N.id == d)
{
P = N;
}
}
if(S != null && P != null)... | 5 |
public final void forward(String target, String... patterns) {
for (String path : patterns) {
pages.forward(target, path);
}
} | 1 |
public boolean equals(Object o) {
MethodType mt;
return (o instanceof MethodType && signature
.equals((mt = (MethodType) o).signature));
} | 1 |
@Override
public void run(ListIterator<Instruction> iter)
throws Exception {
Instruction i = iter.next();
for(Value v : i.getArguments()) {
if(v instanceof DefaultValue) {
i.replaceArgument(v, new Immediate(0));
}
}
} | 2 |
public NumberValidator(String str) {
String[] parts = str.split(",");
if (parts.length > 0)
min = Long.parseLong(parts[0]);
if (parts.length > 1)
max = Long.parseLong(parts[1]);
} | 2 |
public BigDecimal getValue(int row, int clums, int sheetat) {
BigDecimal value = new BigDecimal(0);
String s = null;
try {
hSheet = hWorkbook.getSheetAt(sheetat);
hRow = hSheet.getRow(row - 1);
hCell = hRow.getCell(clums - 1);
hCell.setCellType(Cell.CELL_TYPE_STRING);
s = hCell.getStringCellValue()... | 1 |
public void click(int x, int y)
{
if(x<9*drawSize && y<9*drawSize)
{
Cell clickedCell = grid[y/drawSize][x/drawSize];
if(clickedCell==selectedCell)
{
selectedCell.deselect();
selectedCell = null;
}
else
... | 4 |
public static void addComponentsToPane(Container pane) {
if (!(pane.getLayout() instanceof BorderLayout)) {
pane.add(new JLabel("Container doesn't use BorderLayout!"));
return;
}
JPanel p = new JPanel();
caption = new JLabel("");
caption.setFont(caption.... | 7 |
private void firePieceCompleted(Piece piece) {
for (PeerActivityListener listener : this.listeners) {
listener.handlePieceCompleted(this, piece);
}
} | 1 |
@Override
public void actionPerformed(ActionEvent arg0) {
Object event = arg0.getSource();
int row = 0;
int col = 0;
int bombP = 0;
if(event == confirm){
try{
row = Integer.parseInt(textRow.getText());
}catch(NumberFormatException e){
JOptionPane.showMessageDialog(this, "All Fields need t... | 8 |
public boolean remove(K k) {
Node<K> parent = head;
Node<K> n = head.getRight();
/*
* Sucht Knoten mit zu löschendem Schlüssel.
* Schleife erfasst auch Elternknoten des Knotens.
*/
while (n != nullNode) {
int compare = k.compareTo(n.getKey());
... | 8 |
private void applyInvisibleLinkType(Annotation annotation) {
// clear border thickness
if (linkType == Annotation.INVISIBLE_RECTANGLE) {
Object border = annotation.getObject(Annotation.BORDER_KEY);
if (border != null && border instanceof Vector) {
Vector borderPro... | 5 |
public static void main( String[] args )
{
try{
(new Core(args)).run();
}
catch(FileNotFoundException e)
{
System.out.println(Message.getSSLError("FileNotFound"));
System.out.println("[CRITICAL]: Closing server.");
}
catch(java.net.ConnectException e)
{
... | 8 |
public void run() {
long currentTime = System.currentTimeMillis();
long lastTime;
long deltaMs;
options.save();
fpsCounter = 0;
elapsed = 0;
//resManager.getAudioManager().play();
while(!quitting && !Display.isCloseRequested()) {
... | 4 |
public RollupTaskXmlDriver(String xmlStr) throws DocumentException,
XmlTypeErrorException {
super();
if (!isRollupTaskXml(xmlStr)) {
throw new XmlTypeErrorException("not a valid rollupTask Xml");
}
document = DocumentHelper.parseText(xmlStr);
timestamp = d... | 4 |
public MainViewPanel() {
super();
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
setBackground(Color.WHITE);
for (int i = 0; i < paintings.length; i++)
paintings[i] = new Painting();
for(int i = 0; i< graphics.length; i++)
graphics[i] = paintings[i].createGraphics();
for (int i = 0; i < sli... | 5 |
@Override
public void put( ByteBuffer out, Class<?> v )
{
if ( v == null )
{
out.put( Compress.NULL );
}
else
{
String name = v.getCanonicalName();
Compress.putIntUnsignedNullable( out, name.length() );
out.put( name.getByte... | 2 |
public GenericDAO<Employee> getEmployeesDAO() {
if (_employeesDAO == null) {
_employeesDAO = new GenericDAO(Employee.class);
}
return _employeesDAO;
} | 1 |
public void paintObjects() {
removeAll();
Button btop = new Button("top");
objectsName = new Label[objects.size()];
objectsSize = new Label[objects.size()];
objectsSelect = new Button[objects.size()];
lobjs.setFont(new Font(Font.SERIF, Font.PLAIN, 25));
add(lobjs);
add(btop);
lobjs.setBounds(20,4... | 6 |
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String act = request.getParameter("act");
String message = null;
if (act == null) {
act = "";
} else {
act = act.trim();
}
TimeLogger tl = new TimeLogger();
try {
if... | 8 |
public Board chooseMove() throws Exception{
int ties = 1;
double bestValue = Double.NEGATIVE_INFINITY, currentValue;
Board bestMove = null, currentMove;
double[] results = new double[TaTeTi.MAX_CELLS*TaTeTi.MAX_CELLS];
LinkedList<Board> availableMoves = eg.getAvailableMovesForPla... | 9 |
private static void setSpawnLocation() {
int rand = random.nextInt(8);
switch (rand) {
case 0:
spawnLocation.setVector(110, 425);
break;
case 1:
spawnLocation.setVector(345, 185);
break;
case 2:
spawnLocation.setVector(755, 85);
break;
case 3:
spawnLocation.setVector(1150, 140);
brea... | 8 |
private ArrayList<Operation> getAllOperation(String Declaration) {
ArrayList<Operation> ArrayOperation = new ArrayList();
Declaration = Declaration.trim();
if(Declaration.equals("")){
return ArrayOperation;
} else {
boolean nextop = true;
int i = 0;
while(nextop){
String id ="";
while(Declar... | 8 |
void reprodukcja()
{
// tworzę tablicę skumulowanych wartości przystosowania:
double fittness_skum[] = new double[liczba_rozw];
fittness_skum[0] = fittness[0];
for (int i=1;i<liczba_rozw;i++)
fittness_skum[i] = fittness_skum[i-1] + fittness[i];
Rozw nowa_popul_rozw[] = new Roz... | 8 |
private int YUV_to_BGR(int Y, int u, int v) {
if (Y < 0) {
Y = 0;
}
int tempB, tempG, tempR;
tempB = Y + ((116130 * u) >> 16);
if (tempB < 0) {
tempB = 0;
} else if (tempB > 255) {
tempB = 255;
}
tempG = Y - ((22554 * u... | 7 |
public void reachableClass(String clazzName) {
ClassIdentifier ident = getClassIdentifier(clazzName);
if (ident != null)
ident.setReachable();
} | 1 |
public static void main(String args[]){
String objectListPath = "/u/ml/mindseye/nlg_lm/LM/lesk_syns_purdue.txt";
int no_objects = readObjectList(objectListPath);
String outputMatrixPath = "/u/ml/mindseye/nlg_lm/LM/object_count.txt";
int[] object_counts = new int[no_objects];
String ldcCorpusPath = "/scratc... | 9 |
public static Vector<PhyloTreeEdge> getCommonEdges(PhyloTree t1, PhyloTree t2) {
Vector<PhyloTreeEdge> commonEdges = new Vector<PhyloTreeEdge>();
// if the two trees do not have the same leaf2NumMap
if (!(t1.getLeaf2NumMap().equals(t2.getLeaf2NumMap()))) {
System.out.println("Error:... | 9 |
public static boolean create(String[] args, CommandSender s){
// Various checks to prevent the guild creation from going through if it shouldn't happen
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from i... | 9 |
public long getNumericalAddress() {
return _address;
} | 0 |
public boolean compositeRank()
{
if(throwback)
{
for(Song song: library)
{
double score= (dateAddedWeight*song.getDARank()) + (playCountWeight*song.getPCRank())+ (timeLengthWeight*song.getTLRank());
song.setCompositeScore(score);
}
Collections.sort(library, ScoreComparator.getScorer());
... | 5 |
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("sd");
} | 0 |
public void bidSearch( ) {
FacesContext fc = FacesContext.getCurrentInstance();
try {
Bid_DTO bid = bidService.getBid( idBid );
setIdItem( bid.getIdItem());
setIdUser( bid.getIdUser());
setImporte( bid.getBidPrice() );
} catch (ClassCastException e) {
e.printStackTrace();
} cat... | 3 |
public void przerysujPlansze()
{
liczbaPrzerysowaniaPlanszy++;
for(int k=0;k<10;k++)
for(int l=0;l<10;l++)
{
if(liczbaPrzerysowaniaPlanszy > 1)
{
if(widokRozmiesc.uzytkownik.plansza.l_polaPlanszy_GRACZ[l][k].getRodzajPola().equals("1"))
{
//lb_polaGry[l][k].setBackground(Color... | 5 |
private Header readNextFrame() throws BitstreamException
{
if (framesize == -1)
{
nextFrame();
}
return header;
} | 1 |
@Override
public SyrianEdge getMove(SyrianGraph graph)
throws AgentHasNoMoveException, AgentIsDoneException {
if (this.getLocation() == this.getTarget() && graph.getVerticesWithChemicals().size() == 0){
throw new AgentIsDoneException(this);
}
AbstractList<SimpleHeuristicNode> path = this
.getPathToT... | 7 |
public int getRowInsertionIndex(int y) {
List<Row> rows = mModel.getRows();
int pos = getInsets().top;
int last = getLastRowToDisplay();
for (int i = getFirstRowToDisplay(); i <= last; i++) {
Row row = rows.get(i);
if (!mModel.isRowFiltered(row)) {
int height = row.getHeight();
int tmp = pos + hei... | 4 |
private static Color getColor(int counter) {
return colors[counter % colors.length];
} | 0 |
public void removeEdge(final GraphNode v, final GraphNode w) {
Assert.isTrue(nodes.containsValue(v), "Graph does not contain " + v);
Assert.isTrue(nodes.containsValue(w), "Graph does not contain " + w);
Assert.isTrue(v.succs().contains(w));
if (removingEdge == 0) {
succs(v).remove(w);
} else if (removingE... | 2 |
private void createResolutionCombo(PrintRequestAttributeSet set) {
PrinterResolution[] resolutions = (PrinterResolution[]) mService.getSupportedAttributeValues(PrinterResolution.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
if (resolutions != null && resolutions.length > 0) {
PrinterResolution current = P... | 4 |
public Label nextBlock(final Label label) {
boolean seen = false;
final Iterator iter = code.iterator();
while (iter.hasNext()) {
final Object obj = iter.next();
if (obj instanceof Label) {
if (seen) {
final Label l = (Label) obj;
if (l.startsBlock()) {
return l;
}
} else if ... | 5 |
public static double[] baseProportions(String s)
{
int aCount = 0;
int tCount = 0;
int gCount = 0;
int cCount = 0;
int count = 0;
for (int i = 0; i < s.length(); i++)
{
switch (s.charAt(i))
{
case 'A':
aCount++;
count++;
break;
case 'T':
... | 5 |
public MainFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setSize(800, 600);
setLocationRelativeTo(null);
contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS));
JPanel listPanel = new JPanel();
textField = new JTextField();
textFi... | 3 |
public void BuildMobs() {
for (int i = 0; i < MOBS.length; i++) {
if (Engine.mfo.pfh.ReadPlayerType == 1) {
MOBS[i] = new Sleeper(Engine.mfo.pfh.ReadPlayerX,
Engine.mfo.pfh.ReadPlayerY,
Engine.mfo.pfh.ReadPlayerName,
Engine.mfo.pfh.ReadPlayerLayer);
} else if (Engine.mfo.pfh.ReadPlayerType... | 8 |
public void run(String[] params) {
int codeLine = 0;
for(String string : codeLines) {
codeLine++;
try {
try {
// System.out.println(string);
String[] spl = string.split("\\<");
// System.out.println(spl[1]... | 4 |
public Loader() throws MessageStackException {
copyFile("map.txt");
copyFile("community.txt");
copyFile("events.txt");
if(isSerialized()) {
try {
//reads serialized data from monopoly.ser to get every map data and player data
ObjectInputStream serializedFile = new ObjectInputStream(new FileInputStrea... | 4 |
private static final boolean isFinisher(final int skillid) {
switch (skillid) {
case 1111003:
case 1111004:
case 1111005:
case 1111006:
case 11111002:
case 11111003:
return true;
}
return false;
} | 6 |
private boolean isDead(Node node){
if(node.getX() < 0 || node.getX() > Map.WIDTH){
this.isDead = true;
return true;
}
if(node.getY() < 0 || node.getY() > Map.HEIGHT){
this.isDead = true;
return true;
}
for(Node _node : body){
if(node.isEquals(_node)){
this.isDead = true;
return true;
... | 6 |
public List<Claim> getPublicClaimList(String parentClaimId, String claimType) {
List<Claim> counterclaimList = new ArrayList<Claim>();
Element claimE;
Claim claim;
for (Iterator i = root.elementIterator(claimType); i.hasNext();) {
claimE = (Element)i.next();
if (claimE.element("isDelete").getText().equals... | 4 |
@Override
public int compareTo(Team t) {
if(this.points > t.points) {
return HIGHER;
}
if(this.points == t.points) {
if(this.goalDifference > t.goalDifference) {
return HIGHER;
}
if(this.goalDifference == t.goalDifference) {
if(this.goalsFor > t.goalsFor) {
return HIGHER;
}
if... | 7 |
public void setSecondCorner(Rectangle secondCorner) {
this.secondCorner = secondCorner;
} | 0 |
public void train()
{
training = true;
BHypothesis.training = true;
BHypothesis.MARGIN_RATE = 48D;
for(int i = 0; i < maxRound; i++)
{
for(int j = 0; j < sample.size(); j++)
{
System.err.println((new StringBuilder()).append("Sentence ")... | 9 |
@SuppressWarnings("InfiniteLoopStatement")
private void calculateVerticalScale() {
int scale = 1;
for (Map.Entry<String, Integer> entry : dataToDraw.entrySet()) {
if (entry.getValue() > highestValue) highestValue = entry.getValue();
}
while (true) {
if (high... | 4 |
public static pgrid.service.corba.exchange.ExchangeHandle unchecked_narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof pgrid.service.corba.exchange.ExchangeHandle)
return (pgrid.service.corba.exchange.ExchangeHandle)obj;
else
{
org.omg.CORBA.por... | 2 |
@Override
protected void draw()
{
super.draw();
StringRenderer.drawCenteredString("Select your icon:", this.xSize / 2, 42, 26, true, Color.WHITE);
int xStart = (xSize / 2) - (34 * 4);
boolean hasSelectedSomething = false;
for(int i = 0; i < 8; i++)
{
Monopoly.getInstance().getEngine().bindTexture("... | 8 |
public AndroidSourceSinkManager getSourceSinkManager() {
return sourceSinkManager;
} | 0 |
int getPitchOffsetInterval(KeyEvent e) {
int interval = 0;
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
case KeyEvent.VK_KP_UP:
interval = Pitch.INTERVALS_PER_OCTAVE;
break;
case KeyEvent.VK_DOWN:
case KeyEvent.VK_KP_DOWN:
interval = -Pitch.INTERVALS_PER_OCTAVE;
break;
case KeyEvent.VK_LEFT:... | 8 |
public void start() {
if (hiding) {
// Control software already running, activate GUI updates:
hiding = false;
} else {
control.start();
}
} | 1 |
public static float byte2Float(byte[] b) {
int l = b[0];
l &= 0xff;
l |= (long) b[1] << 8;
l &= 0xffff;
l |= (long) b[2] << 16;
l &= 0xffffff;
l |= (long) b[3] << 24;
return Float.intBitsToFloat(l);
} | 0 |
private void createPatternsImpl(final AngleUnitFlapPattern seed,
final LineType typeToBeAdded, final int indexToAdd, final int additionCount,
final int aimedAdditionCount) {
recursionCount++;
if (acceptablePatternCondition.holds(seed)) {
patterns.add(seed.cloneInstance());
}
if (additionCount == aim... | 7 |
public static void main(String[] args) throws Exception {
new World().live();
} | 0 |
static final void handleMessage(String string, String string_37_,
int i_38_, String string_39_,
String string_40_, int type, int i_42_,
String string_43_) {
try {
anInt10382++;
Message message = Class318_Sub2.messages[99];
for (int i_44_ = 99; (i_44_ ^ 0xffffffff) < -1; i_44_--)
Class31... | 8 |
public static ArrayList<Utilisateur> getAllUtilisateur() {
Statement stat;
ArrayList<Utilisateur> utilisateurs = new ArrayList<>();
try {
stat = ConnexionDB.getConnection().createStatement();
stat.executeUpdate("use nemovelo");
ResultSet res = stat.executeQue... | 4 |
@Override
public Ptg getPtgVal()
{
Object value = getValue();
if( value instanceof Ptg )
{
return (Ptg) value;
}
if( value instanceof Boolean )
{
return new PtgBool( (Boolean) value );
}
if( value instanceof Integer )
{
return new PtgInt( (Integer) value );
}
if( value instanceof Number... | 5 |
@Override
public void executeMsg(Environmental host, CMMsg msg)
{
if((affected instanceof Armor)&&(msg.source()==((Armor)affected).owner()))
{
if((msg.targetMinor()==CMMsg.TYP_REMOVE)
||(msg.sourceMinor()==CMMsg.TYP_WEAR)
||(msg.sourceMinor()==CMMsg.TYP_WIELD)
||(msg.sourceMinor()==CMMsg.TYP_HOLD)
... | 7 |
@SuppressWarnings("unchecked")
protected void UnZip() throws PrivilegedActionException {
String szZipFilePath;
String szExtractPath;
String path = (String) AccessController
.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
return Util.getWorkingDirector... | 7 |
protected void updateText(
final BaseUI UI, Text headerText, Text detailText
) {
if (selected == null) return ;
headerText.setText(selected.fullName()) ;
headerText.append("\n") ;
final String cats[] = selected.infoCategories() ;
if (cats != null) {
for (int i = 0 ; i < cats.length ... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Corner other = (Corner) obj;
if (e1 == null) {
if (other.e1 != null)
return false;
} else if (!e1.equals(other.e1))
return false;
i... | 9 |
private List getPositionsStop(Traject traject) throws FileNotFoundException, UnsupportedEncodingException, IOException {
FileInputStream stream = new FileInputStream("json/stops.csv");
CSVReader reader = new CSVReader(new InputStreamReader(stream, "UTF-8"));
String[] nextLine;
List stop... | 9 |
@Override
public void keyReleased(KeyEvent e) {
boolean unique=true;
if (view.getNameTextField().getText().equals("")){
model.setWarning("Attribute name is empty");
view.getOkButton().setEnabled(false);
} else {
for (int i=0; i<view.getModel().getObjectUmlAtIndex(view.getIndex()).attributListSize(); i++... | 6 |
static void input(double[][] matrix){
for(int i = 0; i < matrix.length; i++){
for(int j = 0; j < matrix[i].length; j++){
matrix[i][j] = scan.nextDouble();
}
}
} | 2 |
public String multiply(String a, String b) {
// Start typing your Java solution below
// DO NOT write main() function
if ("0".equals(b) || "0".equals(a)) // 先排除,不然后面排除更麻烦
return "0";
int m = a.length();
int n = b.length();
if (m < n) {
String c = a;
int p = m;
a = b;
b = c;
m = n;
n = p... | 5 |
public static JsonElement fetchJson(String username, String password, String urlEndpoint) throws IOException {
URL url = new URL(urlEndpoint);
URLConnection urlConnection = url.openConnection();
if (username != null && password != null) {
String authString = username + ":" + passwor... | 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 |
private boolean checkQuantity(Item item, Order cOrder, int quantity, boolean checkCart) throws Exception {
ItemStack is = cOrder.getItem(item.getId());
int checkQt = quantity;
if (is != null && checkCart) {
checkQt += is.quantity; // we have to check quantity summing items already in... | 7 |
public boolean opEquals(Operator o) {
return (o instanceof BinaryOperator)
&& o.operatorIndex == operatorIndex;
} | 1 |
@Override
public void setSourceItem( DefaultBox<?> sourceItem ) {
if( sourceItem != null ) {
comment = (DefaultCommentBox) sourceItem;
comment.setConnection( this );
} else {
comment = null;
}
super.setSourceItem( sourceItem );
} | 2 |
private double shade()
{
Vector poi = i.poi;
Ray ray;
LinkedBody lb;
Body b;
int numLights = lights.length;
double distance = -1.0,
brightness = 0.0,
lambertian = 0.0,
brightnessPerLight = 1.0 / numLights;
boolean hitSomething;
for (Vector L : lights)
{
lambertian = L.dot(i.nor... | 7 |
private String map(int year, int month, int day)
throws NodeMeaningKeyErrorException {
System.err.println(year + "/" + month + "/" + day);
year -= baseYear;
if (year < minYear || year > maxYear) {
throw new NodeMeaningKeyErrorException();
}
if (month < min... | 6 |
public boolean isItemConnected(int xx, int yy) {
try { if(enabledGrid[xx-1][yy]) return true; } catch (Exception e) {}
try { if(enabledGrid[xx+1][yy]) return true; } catch (Exception e) {}
try { if(enabledGrid[xx][yy+1]) return true; } catch (Exception e) {}
try { if(enabledGrid[xx][yy-1]) return true; } catch ... | 8 |
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.