text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static void db(final String s) {
if (Specialize.DEBUG) {
System.out.println(s);
}
} | 1 |
public void dragGestureRecognized(DragGestureEvent dge) {
JComponent c = (JComponent) dge.getComponent();
DefaultTransferHandler th = (DefaultTransferHandler) c.getTransferHandler();
Transferable t = th.createTransferable(c);
if (t != null) {
scrolls = c.... | 9 |
public double getSternCapacitance(){
if(!this.sternOption){
System.out.println("Class: GouyChapmanStern\nMethod: getSternCapacitance\nThe Stern modification has not been included");
System.out.println("A value of infinity has been returned");
return Double.POSITIVE_INFINITY;
... | 6 |
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 |
static int process(String line) {
int[] arr = giveArray(line.trim().split(" "));
int n = arr[0], p = arr[1];
if(n == 0 && p == 0)
return 0;
for(int i = 0; i < n; i++) {
readLine();
}
String name = null;
int met = -1;
double best = -1;
for(int i = 0; i < p; i++) {
String s = readLine().trim... | 9 |
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} | 6 |
void print() {
System.out.println("@RELATION Untitled");
for(int i = 0; i < m_attr_name.size(); i++) {
System.out.print("@ATTRIBUTE " + m_attr_name.get(i));
int vals = valueCount(i);
if(vals == 0)
System.out.println(" CONTINUOUS");
else
{
System.out.print(" {");
for(int j = 0; j < vals; j... | 8 |
public void removeNode(Byte N) {
if(networkTreeMap.containsKey(N)){
for(Object nb : networkTreeMap.get(N).toArray()) {
removePath((Byte)nb, N);
}
}
networkTreeMap.remove((byte)N);
if(autoUpdate) {
update();
}
} | 3 |
@Override
public void processNPC() {
super.processNPC();
target = this.getCombat().getTarget();
if (spawnTime + 300000 < Utils.currentTimeMillis()
&& !this.getCombat().underCombat()) {
finish();
}
if (target != null) {
if (target instanceof Familiar) {
Familiar npc = (Familiar) target;
targ... | 6 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DataStructure that = (DataStructure) o;
if (calibrationKey != that.calibrationKey) return false;
if (implementedChannels != that.implementedCha... | 7 |
private static String convertToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9))
... | 4 |
public void printRowResult2(ArrayList<Row> rows, boolean headerLine) {
System.out.println("==============================================");
if (rows.size() == 0) {
System.out.println("No Result");
}
Iterator<Row> it = rows.iterator();
int c = 0;
while (it.hasNext()) {
Row r = it.next();
if (c ==... | 9 |
@Override
public boolean isValid(final Object value, final String type, final Dimension dimension) {
if (!(value instanceof PostilionAddAmount[])) {
return false;
}
final PostilionAddAmount[] addAmounts = (PostilionAddAmount[]) value;
if (addAmounts.length < 1 || addAmounts.length > 6) {
r... | 9 |
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(Validate.isPlayer(sender)) {
sender.sendMessage("§6===== [§b Online Players §6] =====");
for(ServerId sid : ServerId.values()) {
if(plugin.getServerManager().ge... | 8 |
public void dropInfo(int howMuch) {
if ((howMuch & UNKNOWNATTRIBS) != 0)
unknownAttributes = null;
} | 1 |
public static void main(String[] args) throws IOException {
List<String> fileList = unpackTIPP(INPUT_ZIP_FILE, OUTPUT_FOLDER);
for (int x = 0; x <= fileList.size() - 1; x++) {
System.out.println("fileList" + x + "==" + fileList.get(x));
}
String fileURL = "https://raw.gi... | 2 |
public EntidadBancaria read(int idEntidadBancaria){
try{
String selectEntidad = "SELECT * FROM entidadbancaria where identidad = ?;";
EntidadBancaria entidadBancaria;
Connection connection = connectionFactory.getConnection();
PreparedStatement prepared = connection.prepareStateme... | 3 |
@Override
public boolean addMod(String modName)
{
if (modName == null || modName.length() < 1) return false;
if (modName.equalsIgnoreCase("all")) return false;
if (!this.modList.contains(modName))
{
this.modList.add(modName);
this.saveConfig();
return true;
}
return false;
} | 4 |
public CeremonialSword(){
this.name = Constants.CEREMONIAL_SWORD;
this.attackScore = 8;
this.attackSpeed = 12;
this.money = 150;
} | 0 |
public void update() {
for (int y = 0; y < ySize; y++) {
for (int x = 0; x < ySize; x++) {
Site site = scape.grid[x][y];
JLabel label = labels[x][y];
double energy = site.getFood();
double div = (255 / scape.maxFood) * energy;
int gradient = (int) (255 - div);
Color background;
backgr... | 4 |
public static String createChatLeftMessage(String myName) {
JSONObject jsonMsg = new JSONObject()
.element( "code", "5" )
.element( "name", myName );
;
return jsonMsg.toString();
} | 0 |
protected static void runLoop() {
if (loop) return ;
LoadService.loadPackage("src") ;
rendering() ;
if (scenario != null) {
scenario.updateGameState() ;
}
lastUpdate = lastFrame = timeMS() ;
loop = true ;
long simTime = 0, renderTime = 0, loopNum = 0 ;
while (loop) {
... | 7 |
private double[] logPToP(double[] llContribution, double[] pPrevious) {
double[] p = new double[llContribution.length];
double sum = 0.0;
for( int i = 0; i < llContribution.length; ++i) {
p[i] = Math.exp(llContribution[i]);
sum += p[i];
}
// Normalization
if( pPrevious != null)
if( sum != 0.0)... | 7 |
public static LinkedList<Task> smartSearch(String searchLine,
LinkedList<Task> bufferedTaskList,
SEARCH_TYPES searchType,
SEARCH_TYPES searchAlgoType){
//Task that is collated through the searches.
LinkedList<Task> matchedTasks = new LinkedList<Task>();
switch (searchAlgoType) {
case SEARCH_... | 8 |
public static void main(final String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
String fileToOpen = null;
boolean isOpeningClipboard = false;
try{
for(int i=0;i<args.length;++i){
String arg = args[i];
if (arg.startsWith("-"))... | 8 |
protected void setStringToPush(String stringToPush) {
/*
* if (!automata.StringChecker.isAlphanumeric(stringToPush)) throw new
* IllegalArgumentException("Push string must "+ "be alphanumeric!");
*/
PushdownAutomaton myPDA = (PushdownAutomaton) this.getAutomaton();
if (myPDA.singleInputPDA && stringToPus... | 2 |
public void crossReferenceImplementedInterfaces() throws CrossReferenceException
{
Set<String> unresolved = new HashSet<String>();
for (String clazz : implementsIndex.keySet())
{
Set<String> intfs = implementsIndex.get(clazz);
for (String intf : intfs)
{
if (i... | 7 |
public void ClearCircle(int X, int Y, int R)
{
// long time = System.nanoTime();
for (int i1 = Math.max(X-(R+1),0); i1 < Math.min(X+(R+1),w); i1 ++)
{
for (int i2 = Math.max(Y-(R+1),0); i2 < Math.min(Y+(R+1),h); i2 ++)
{
if (... | 7 |
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
in.useLocale(Locale.US);
StringBuilder out = new StringBuilder();
while (in.hasNext()) {
int size = (int) in.nextDouble();
double[] d = new double[4];
int allow = 0;
for (int i = 0; i < size; i++) {
... | 9 |
@command(
maximumArgsLength=0,
description="null command",
permissions="*")
public void Null(CommandSender sender,String[] args){
for(Field f:this.getClass().getFields()){
if(f.isAnnotationPresent(config.class)){
try{
if(f.getType()==Location.class){
if(f.get(this)!=null){
sender... | 8 |
public E getDataIndex(String pIndex){
E resp = null;
for(Nodo<E> i = cabeza; i != null; i=i.getSiguiente()){
if(i.getIndex() == pIndex)
resp = i.getDato();
}
return resp;
} | 2 |
@Override
public Object item(int index) {
Object value = null;
switch (BOMColumn.values()[index]) {
case ID:
value = getPart().getId();
break;
case QUANTITY:
value = getQuantity();
break;
case COST:
... | 8 |
protected static boolean isReserved(String key) {
return "highlight".equals(key)
|| "name".equals(key)
|| "resource".equals(key)
|| "thumbnail".equals(key)
|| "topic".equals(key)
|| "upper".equals(key)
|| "user".equals(key)
|| "_id".equals(key);
} | 7 |
static double computeArea(Circle cs[]){
double ans = 0.0;
for (int i = 0; i < cs.length; ++i){
boolean flag = false;
for (int j = i+1; j < cs.length; ++j){
if (cs[i].isIntersected(cs[j]) || cs[i].contains(cs[j])){
flag = true;
... | 5 |
public void start(String dest, long _maxSize){
if(_maxSize < 0)
{
maxSize = estimateMaxCapacity();
System.out.println("Maximum estimated size: " + maxSize);
}
else
{
maxSize = _maxSize;
}
try {
// send request
... | 5 |
public void deleteLines(int[] indices) {
int j, k;
if (indices != null) {
for (int i = 0; i < indices.length; i++) {
for (k = indices[i]+i; k > 0; k--) {
for (j = 0; j < tailleY; j++) {
plateau[k][j] = plateau[k - 1][j];
... | 4 |
public RoomEvent findRoomEventById(final Long id) {
return new RoomEvent();
} | 0 |
public boolean isBossOnStatus() {
if(frame == null) buildGUI();
return bossStatus.isSelected();
} | 1 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if(activated() && (tickID==Tickable.TICKID_ELECTRONICS))
{
if(!amWearingAt(Wearable.IN_INVENTORY))
setPowerRemaining(powerRemaining()-1);
if(powerRemaining()<=0)
{
setPowerRemaining(0)... | 7 |
public static void htmlWriteFindObjectResponsePage(String modulename, String objectname, String objecttype, Keyword matchtype, org.powerloom.PrintableStringWriter stream) {
{ Module module = Stella.getStellaModule(modulename, false);
if (module == null) {
OntosaurusUtil.htmlUnknownModuleResponse(Onto... | 6 |
public static void main(String[] args)
{
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c");
list.add("d");
for(int i = 0; i < list.size();i++){
String value = list.get(i);
System.out.println(value);
}
for(Iterator<String> iter = list.iterator();iter... | 2 |
public static String capitalize(String s) {
if (null == s) {
return null;
}
if (s.length() == 0) {
return "";
}
char char0 = s.charAt(0);
if (Character.isUpperCase(char0)) {
return s.toString();
}
return new StringBuilder(s.length()).append(Character.toUpperCase(char0)).append(s.subSequence(1... | 3 |
public void connectData() {
switch (selectResult) {
case 1: // 表示连接的是mysql
url = DriverString.MYSQL_JDBC + hostName + ":" + port + "/";
ConnectDB.url = url;
ConnectDB.user = name;
ConnectDB.password = password;
if(dataField.getItemCount() != 0){
dataField.removeAllItems();
}
dataField.addI... | 6 |
public String inspect(Object o) {
Class c = o instanceof Class ? (Class) o : o.getClass();
StringBuilder sb = new StringBuilder();
sb.append("Class: ").append(c.getName()).append("\n");
sb.append("Methods:\n");
Method[] methods = c.getDeclaredMethods();
for (Method me... | 6 |
public SLPanel() {
addComponentListener(new ComponentAdapter() {
@Override public void componentResized(ComponentEvent e) {
if (currentCfg != null) initialize(currentCfg);
}
});
} | 1 |
public Game getGame(String uuid) {
Game result = null;
Connection con = null;
PreparedStatement statement = null;
ResultSet rs = null;
try {
con = getConnection();
if (con != null) {
statement = con.prepare... | 8 |
private void processSplits(JDialog parent) {
//
// Display the splits dialog
//
if (splits == null)
splits = new ArrayList<TransactionSplit>(5);
AccountRecord account = null;
int index = accountField.getSelectedIndex();
if (index >= 0)
ac... | 7 |
private void matrixChainOrder(int p[])
{
for (int i = 1; i <= n; i++)
m[i][i] = 0;
/*
* The bottom up calculation needs to proceed only in the upper
* triangle and that too diagonal-wise as
* 1. i < j and m[i][j] for i > j does not makes sense
* 2. The diagonal represents the solution of the s... | 5 |
public TimelineView(Timeline timeline) {
this.timeline = timeline;
for (Timeline.TimelineItem item: timeline) {
timelineView.add(0, new TimelineItemView(item));
}
} | 1 |
public Graphics getOffScreenGraphics() {
Dimension d = getSize();
if (offScreen == null || offScreen.getWidth(null) != d.width || offScreen.getHeight(null) != d.height) {
offScreen = createImage(d.width, d.height);
}
return offScreen.getGraphics();
} | 3 |
public void addListeners() {
// Start Button Pressed
start.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String input = tf.getText();
try{
int newGoal = Integer.parseInt(input);
if (worker == null) {
worker = new WorkerThread(0, newGoa... | 3 |
@Override
public void update()
{
if(BulletImage.getDirection()==BulletDirection.E)
{
xLocation+=velocity;//moves bullet east
}
else if(BulletImage.getDirection()==BulletDirection.W)
{
xLocation-=velocity;
}
else if(BulletImage.getDirection()==BulletDirection.SW)
{
xLocation-=velocity;
yLo... | 6 |
@Override
public void mouseReleased(MouseEvent e) {
selecting = false;
mouseEndPt = e.getPoint();
Node n1=null;
Node n2 = null;
graphPanel.add(graphLabel5,BorderLayout.PAGE_END);
graphLabel5.setVisible(false);
mouse... | 7 |
private void comparePasswords(JPasswordField pf1, JPasswordField pf2, JButton btn)
{
char[] p1 = pf1.getPassword();
char[] p2 = pf2.getPassword();
boolean verified = true;
if (p1.length == 0 || p2.length == 0) verified = false;
for (int i = 0; i < p1.length && i < p2.length; i++)
{
if (p1.length != ... | 7 |
public Direction getOpositeDirection() {
switch (this) {
case UP:
return DOWN;
case DOWN:
return UP;
case LEFT:
return RIGHT;
case RIGHT:
return LEFT;
default:
return UP;
... | 4 |
public static void main(String[] args) throws IOException, WrongArgumentException, JDOMException, InterruptedException {
// TODO Auto-generated method stub
int [] srcStart = {0,0,0};
int [] vsize = {900,247, 20};
int [] shape = {90,50,20};
int [] srcShape = {9,1,1};// �д洢
int [] dstShape = {9,5,4};
int []... | 4 |
public static void moveRecursive(Towers towers, char from, char to, int num) {
//If we're trying to move a single disc, just move it.
if (num == 1) {
boolean status = towers.moveDisc(from, to);
if (!status) {
throw new RuntimeException("Bad move attempted from tow... | 6 |
public void connectOk()
{
try
{
if(chat.connected)
chat.disconnect();
userlist.reset();
// must make copies of strings here since dialog is closed afterward!
String address = new String(cd.address.getText());
String port = new String(cd.port.getText());
String nam... | 8 |
public static S3Object uploadObject(S3Object s3object, S3Bucket s3bucket, RestS3Service s3service){
S3Object s3objectRes = null;
try {
s3objectRes = s3service.putObject(s3bucket, s3object);
} catch (S3ServiceException e) {
e.printStackTrace();
}
return s3objectRes;
} | 1 |
public void insert(int value) {
Binarynode node = new Binarynode(value);
size++;
if (size == 1) {
root = node;
return;
}
Binarynode helpnode = root;
String binary = Integer.toBinaryString(size);
for (int i = 1; i < binary.length() - 1; i++)... | 4 |
public static void main(String[] args) throws IOException {
//Get the file
BufferedReader inFile = new BufferedReader(new FileReader(System.getProperty("user.dir") + "/src/Files/prog213a.dat"));
//Define a variable to store the current line
String line;
//define week calculating pay for curent week
int week... | 8 |
public double getProgressPercentage() {
return 100 * (getProgress() / (double) getSize());
} | 0 |
protected void exchange(String[] argv) {
int bottom = first_nonopt;
int middle = last_nonopt;
int top = optind;
String tem;
while (top > middle && middle > bottom) {
if (top - middle > middle - bottom) {
// Bottom segment is the short one.
int len = middle - bottom;
int i;
// Swap it with... | 5 |
public void ConfirmTrade() {
if (TradeConfirmed == false) {
RemoveAllWindows();
for (int i = 0; i < playerOTItems.length; i++) {
if (playerOTItems[i] > 0) {
addItem((playerOTItems[i] - 1), playerOTItemsN[i]);
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter("logs... | 9 |
public String interpret(Symtab st) {
String result = "";
String typeStr = Utils.translateType(type.toString(), st);
if (st.lookup(type.toString()) != null) {
if (parlist == null)
result += type.toString() + " " + ident + " = new " + type.toString() + "();\n";
else {
result += type.toString() + " " +... | 5 |
private static int readToBufferUntil(
byte[] bytes, int from, int to, int maxOffset,
StringBuilder buffer, byte delimiter)
throws IOException {
int i = from;
while ((i < to) && (bytes[i] != delimiter)
// The reserved characters 0x00 (NUL), 0x02 (STX),
// 0x03 (ETX), 0x09 (TAB) are not allowed in any ... | 9 |
@Override
public void allowAttempt(String username) throws UserLockedOutException {
if(username == null) {
logger.debug("Null username.");
return;
}
UserLockoutStatus status = lockoutMap.get(username);
if(status == null) {
logger.debug("No lockout status found for " + username);
return;
... | 5 |
protected void drawDays() {
Calendar tmpCalendar = (Calendar) calendar.clone();
int firstDayOfWeek = tmpCalendar.getFirstDayOfWeek();
tmpCalendar.set(Calendar.DAY_OF_MONTH, 1);
int firstDay = tmpCalendar.get(Calendar.DAY_OF_WEEK) - firstDayOfWeek;
if (firstDay < 0) {
... | 7 |
public void AVLdelete(Node poistettava) {
// Varmistetaan, ettei tyhjää koiteta poistaa
if (poistettava != null) {
Node poistettu = delete(poistettava);
// Jos poistettiin jotain
if (poistettu != null) {
Node alipuu;
Node p = poistettu.... | 7 |
public String getsuit() {
return suit;//Accesses the Card's suit and returns the Card's suit
} | 0 |
@Override
public String execute(SessionRequestContent request) throws ServletLogicException{
String page = ConfigurationManager.getProperty("path.page.edituser");
resaveParamsSaveUser(request);
try {
Criteria criteria = new Criteria();
User currUser = (User) request.g... | 2 |
public int numeroPontos(int x) {
int nPontos = 0;
if (this.realizada == true) {
switch (x) {
case 1:
if (obtemResultado().equals(this.nomeTimeLocal)) {
nPontos = 3;
} else {
if ("Empate".e... | 9 |
public void go() {
setUpGui();
try {
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();
int[] eventsIWant = {127};
sequencer.addControllerEventListener(ml, eventsIWant);
Sequence seq = new Sequence(Sequence.PPQ, 4);
Track track = seq.createTrack();
int r = 0;
f... | 2 |
protected void updatePlus(Item item, Object element) {
boolean hasPlus = getItemCount(item) > 0;
boolean needsPlus = isExpandable(item, null, element);
boolean removeAll = false;
boolean addDummy = false;
Object data = item.getData();
if (data != null && equals(element, data)) {
// item shows same elemen... | 8 |
@Override
public int compareTo(Interval<T> o) {
int result = low.compareTo(o.low);
if (result == 0) {
if (isClosedOnLow != o.isClosedOnLow) {
result = isClosedOnLow ? -1 : 1;
} else {
result = high.compareTo(o.high);
if (result == 0) {
if (isClosedOnHigh != o.isCl... | 6 |
protected boolean checkDroppedGlList(int gl, int user)
{
int i =0;
FnbDroppedPacketInfo glID_uID;
while (i < droppedGl_user.size())
{
glID_uID = (FnbDroppedPacketInfo) droppedGl_user.get(i);
if ((glID_uID.getGridletID() == gl) && (glID_uID.getUserID() == user)... | 3 |
public static XPathException testConformance(
ValueRepresentation val, SequenceType requiredType, XPathContext context)
throws XPathException {
ItemType reqItemType = requiredType.getPrimaryType();
final Configuration config = context.getConfiguration();
final TypeHierarchy th = ... | 9 |
@Override
public int hashCode()
{
int result = start != null ? start.hashCode() : 0;
result = 31 * result + (finish != null ? finish.hashCode() : 0);
return result;
} | 2 |
public static void readMemoryIn(String path) throws InvalidClassException {
try {
try (FileInputStream fileIn = new FileInputStream(("".equals(path) ? "pitmanager" : path));
ObjectInputStream in = new ObjectInputStream(fileIn)) {
Competition.setInstance((Competit... | 3 |
@Override
protected void generateFrameData(ResizingByteBuffer bb)
throws FileNotFoundException, IOException {
// TODO: don't always reload (but maybe this is appropriate for big images)
bb.put(this.reload());
} | 0 |
private void parseConnection(NodeList childNodes)
{
Connect connect = new Connect();
boolean flagOpen = false;
boolean flagClosed = false;
for (int count = 0; count < childNodes.getLength(); count++)
{
Node node = childNodes.item(count);
if ("from".equ... | 7 |
@Override
protected void dataAttributeChanged(final BPKeyWords keyWord, final Object value) {
super.dataAttributeChanged(keyWord, value);
if (value != null) {
if (keyWord == BPKeyWords.ACTOR || keyWord == BPKeyWords.AUTO_ASSIGN
|| keyWord == BPKeyWords.MULTIPLE_EXECUT... | 5 |
private static ArrayList<Item> readItemList() {
ArrayList<Item> ret = new ArrayList<Item>();
try {
BufferedReader br = new BufferedReader(new FileReader(new File("isaacitemlist.txt")));
String line = null;
while ((line = br.readLine()) != null) {
ret.add(new Item(line.split(",")[0], "passive"... | 6 |
public static void helper(List<List<Integer>> results, List<Integer> result,
int target, int index, int[] num, boolean[] visited) {
if (target == 0) {
results.add(new ArrayList<Integer>(result));
return;
}
if (index == num.length)
return;
for (int i = index; i < num.length; i++) ... | 7 |
public Document toDOM(Serializable structure)
{
RegularPumpingLemma pl = (RegularPumpingLemma)structure;
Document doc = newEmptyDocument();
Element elem = doc.getDocumentElement();
elem.appendChild(createElement(doc, LEMMA_NAME, null, pl.getTitle()));
elem.appendC... | 3 |
private static String getLocalServers(com.grey.logging.Logger logger) throws javax.naming.NamingException
{
javax.naming.directory.DirContext ctx = getDnsContext(null);
java.util.Hashtable<?, ?> env = ctx.getEnvironment(); //NB: Does not return same object we passed into constructor
ctx.close();
Object provide... | 9 |
@Override
public int hashCode()
{
int result = 17;
result = 37 * result + name.hashCode();
result = 37 * result + attributes.hashCode();
result = 37 * result + (hasChildren ? 0 : 1);
if(isText())
{
result = 37 * result + text.hashCode();
}
return result;
} | 2 |
@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 AyuntamientoPK)) {
return false;
}
AyuntamientoPK other = (AyuntamientoPK) object;
if ((this.localidad == null ... | 9 |
public BadConfigFormatException(String newMessage) {
super(newMessage);
message = newMessage;
// write to the log file
PrintWriter writer = null;
try {
writer = new PrintWriter("log.txt");
} catch (FileNotFoundException e) {
System.out.println("Writer didn't load");
}
writer.println(newMessage);
... | 1 |
private void startMapView() {
try {
viewer = new MapView(this);
viewer.setVisible(true);
} catch (Exception ex) {
Logger.getLogger(MapModel.class.getName()).log(Level.SEVERE, null, ex);
System.exit(0);
}
} | 1 |
public int uniquePathsWithObstacles(int[][] obstacleGrid) {
int m = obstacleGrid.length, n=obstacleGrid[0].length;
int[][] steps = new int[m][n];
steps[0][0] = (obstacleGrid[0][0]==0?1:0);
for(int i =1; i<m; i++)
steps[i][0] =(obstacleGrid[i][0]==1? 0:steps[i-1][0]);
for(int i =... | 8 |
private void saveScene(){
if(fileName.compareTo("")==0){
JFileChooser jfcSave = new JFileChooser("./");
if(jfcSave.showSaveDialog(null)==JFileChooser.APPROVE_OPTION){
drawPanel.save(jfcSave.getSelectedFile().getAbsolutePath(), true);
fileName = jfcSave.getSelectedFile().getAbsolutePath();
}
}else{
... | 2 |
@Override
public void virusAttack(int iterationNum) {
if (updateInfectionStatus && iterationNum != this.timeOfUpdate) {
this.infectionStatus = true;
} else {
if (random.getResult()) {
this.updateInfectionStatus = true;
this.timeOfUpdate = itera... | 3 |
public int canCombine(CombineableOperator combOp) {
// GlobalOptions.err.println("Try to combine "+e+" into "+this);
if (combOp.getLValue() instanceof LocalStoreOperator
&& ((Operator) combOp).getFreeOperandCount() == 0) {
// Special case for locals created on inlining methods, which may
// combine everyw... | 8 |
public static void JSError(Exception e) {
if (e instanceof WrappedException) {
WrappedException ex = (WrappedException) e;
System.err.printf("[JSBot Runtime Error] %s\n", ex.getMessage());
} else if (e instanceof EcmaError) {
EcmaError ex = (EcmaError) e;
System.err.printf("[JSBot ScriptSyntax Error] %s... | 2 |
public static String getExtendedEntityList(boolean subtypes)
{
final int charLimit = 68;
int currentLoc = 1;
StringBuilder list = new StringBuilder();
for (ExtendedEntityType type : entityTypes.values())
{
if (subtypes && !type.hasParent() || !subtypes && type.hasParent())
continue;
Strin... | 7 |
@Test
public void testEmptyXmlFieldException() throws Exception {
try {
final PaymentResponse response = deserializeFromXml(
"src/test/java/ru/arsenalpay/api/unit/support/api_empty_field_response.xml"
);
System.out.println(response);
assert... | 1 |
public DefaultNetwork(int inputs, int outputs, int hiddenLayers, int neuronsPerLayer, int maxInputThreshold, int maxOtherThreshold)
{
inputLayer = new Layer();
for(int i = 1; i <= inputs; i++)
{
Neuron neuron = new DefaultNeuron(generateThreshold(maxInputThres... | 6 |
public void addPropertyChangeListener(PropertyChangeListener listener) {
this.riverChangeSupport.addPropertyChangeListener(listener);
for (River r: rivers) {
r.addPropertyChangeListener(this);
}
} | 1 |
public void divideProvincesHistorically() {
GameData.CURRENT_SCENARIO = "historical";
for (Province province : GameData.provinces) {
if (GameData.PLAYER_AMOUNT == 2) {
if (province.getNation() == Nationality.NEDERLANDS) {
province.setPlayer(GameData.PLAYER_ONE);
} else if (province.getNation() ==... | 9 |
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.