text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void finalize( Connection connection, DefaultBox<?> source, DefaultBox<?> target ) {
AbstractConnection con = (AbstractConnection) connection;
con.setSourceItem( source );
con.setTargetItem( target );
} | 2 |
public String getProperty(String property){
try {
r = new BufferedReader(new FileReader(config));
} catch (IOException e) {
}
String temp;
try {
while((temp = r.readLine()) != null){
if(temp.startsWith(property)){
return temp.replace(property + ": ", "");
}
}
} catch (IOException e) {
... | 4 |
public String toString() {
String temp = "";
for (int y = rows-1; y > -1; y--) {
for (int x = 0; x < cols; x++) {
if (board[x][y].getState() == EMPTY) {
temp = temp + "-";
}
else if (board[x][y].getState() == PLAYER_ONE) {
temp = temp + "O";
}
else {
temp = temp + "X";
... | 4 |
public int calculateSelectedAttribute(TreeNode node) {
int selectedAttribute = -1;
double minRelativeEntropy = 999999;
for(int i : node.unProcessedAttributes) {
int total = node.Y.size();
int count[][] = new int[attributePossibleValues[i]][classValues];
for(int j = 0; j < total; j++) {
count[node.X.g... | 8 |
public void Set_edgeweight() {
int ni = t_partialedgeweight.length;
int nj = t_partialedgeweight[0].length;
for (int i = 0; i < ni; i++) {
for (int j = 0; j < nj; j++) {
Float temp = t_edgemultiplier.get(i);
t_edgeweight[i][j] = t_partialedgeweight[i][j] * temp;
}
}
} | 2 |
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
CalendarUtility cu = new CalendarUtility();
// Params
int weekNum;
try {
weekNum = Integer.parseInt(request.getParameter("week"));
} catch (Exception e) {
weekNum = cu.getCurrentWee... | 7 |
public static boolean isHavePositionCloseToCenter(Polygon polygon, Integer distance) {
if (distance == null)
return false;
for (Position position : polygon.getPositions()) {
Position centerPosition = MathService.positionOfCenter(polygon);
// if (position.getDistanceTo... | 4 |
public void actionPerformed(ActionEvent e) {
if (e.getSource() == cancelButton) {
do_cancelButton_actionPerformed(e);
}
if (e.getSource() == btnVerificaComunicacao) {
try {
try {
do_button_actionPerformed(e);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} catch (IOExc... | 4 |
public void edit(Usuario usuario) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
usuario = em.merge(usuario);
em.getTransaction().commit();
} catch (Exception ex) ... | 5 |
public void setP(Product p) {
this.p = p;
this.prezzo = p.getPrice();
} | 0 |
public Tessellator( int fraction, float smooth, Color color, long seed )
{
this.fraction = fraction;
if ( fraction % 2 != 0 )
this.fraction--;
this.color = color;
this.smooth = smooth;
this.noise = NoiseHelper.generatePerlinNoise( fraction + 1, fraction + 1, 5, seed );
Mesh model = calculateTesselator()... | 1 |
public static ArrayList<String> getDoors(int roomId) {
ArrayList<String> doors = new ArrayList<String>();
if(getNextRoomId("north", roomId) != 0) {
doors.add("North");
} if(getNextRoomId("east", roomId) != 0) {
doors.add("East");
} if(getNextRoomId("south", roomId) != 0) {
doors.add("South");
} if... | 4 |
public boolean deleteNode(Node node) {
if (this.next == null) {
return false;
} else if (this.next.data.equals(node.data)) {
this.next = next.next;
next.previous = this;
return true;
} else {
return this.next.deleteNode(node);
}
} | 2 |
private Column getLengthColumn( Token token ) {
LengthColumn column = new LengthColumn();
if ( token.equals( FieldType.LONG ) ) {
column.setType( FieldType.LONG );
}
else if ( token.equals( FieldType.INTEGER ) ) {
column.setType( FieldType.INTEGER );
}
... | 7 |
private void loadFromFile() {
URI uri;
try {
uri = ResourceLoader.loadData(ResourceLoader.MASTER_FILENAME)
.toURI();
File masterFile = new File(uri);
BufferedReader bfr = new BufferedReader(new FileReader(masterFile));
String line = "";
int y = 0;
while ((line = bfr.readLine()) != null) {
... | 5 |
public void parseInput(String fileName)
{
InputStream is = null;
BufferedReader br = null;
try {
is = Thread.currentThread().getContextClassLoader().getResourceAsStream("input.txt");
br = new BufferedReader(new InputStreamReader(is));
String line... | 7 |
public InputStream getData() {
return data;
} | 0 |
@Override
public void keyTyped(KeyEvent ke) {
char c = ke.getKeyChar();
if (c == '\n' || c == '\r') {
lastKey = "enter";
} else if (c == '\t') {
lastKey = "tab";
} else if (c == '\b') {
lastKey = "backspace";
} else if (c == ' ') {
... | 6 |
public String getcalibParam() {
if (calibParam == null) {
throw new RuntimeException("missing calibParam name.");
}
return calibParam;
} | 1 |
public boolean isMember(InfoRequest infoRequest) throws MailChimpException {
String post = post("/lists/member-info", infoRequest, new Function<InfoRequest, String>() {
@Override public String apply(InfoRequest input) {
return gson.toJson(input);
}
});
System.out.println(post);
retur... | 0 |
@Override
public void deserialize(Buffer buf) {
fightId = buf.readInt();
if (fightId < 0)
throw new RuntimeException("Forbidden value on fightId = " + fightId + ", it doesn't respect the following condition : fightId < 0");
int limit = buf.readUShort();
alliesId = new int... | 3 |
public List<GeneratedImage> buildCreatedFiles() throws IOException, InterruptedException {
boolean error = false;
final List<GeneratedImage> result = new ArrayList<GeneratedImage>();
for (File f : dir.listFiles()) {
if (error) {
continue;
}
if (f.isFile() == false) {
continue;
}
if (fileToP... | 9 |
public void run() {
openDoor();
closeDoor();
startPower();
touchPower();
} | 0 |
public void clearLabels(){
Labels.clear();
} | 0 |
protected LinkedList[] createAdjacentLinkedListGraph(int n,int[][]edges){
LinkedList[] adjacentList=new LinkedList[n];
for(int i=0;i<n;++i) adjacentList[i]=new LinkedList();
for(int i=0;i<edges.length;++i){
adjacentList[edges[i][0]].add(edges[i][1]);
adjacentList[edges[i]... | 2 |
public boolean isMoveAllowed(int fromX, int fromY, int toX, int toY) {
if(toX >= 0 && toY >= 0 &&
toX < map.getWidth() && toY < map.getHeight()) {
final int code = map.get(1, toX, toY);
final int feature = FeatureCodes.getFeature(code);
return
... | 6 |
public Boardable[] entrances() {
if (entrances != null) return entrances ;
entrances = new Boardable[4] ;
final Tile o = origin() ;
final World world = o.world ;
final int h = size / 2, s = size ;
entrance = null ;
entrances[0] = world.tileAt(o.x + h, o.y + s) ;
entrances[1] = world... | 6 |
private void quicksort(int low, int high) {
int i = low, j = high;
// Get the pivot element from the middle of the list
int pivot = numbers[pivot(numbers, low, high + 1)];
// Divide into two lists
while (i <= j) {
// If the current value from the left list is smaller... | 6 |
public static String getMessageDigestForUrl(String fileUrl)
throws FileNotFoundException, IOException {
String messageDigest = null;
if (fileUrl != null && !fileUrl.isEmpty()) {
try {
InputStream fis = new URL(fileUrl).openStream();
MessageDigest md5 = MessageDigest.getInstance("SHA");
byte[] byte... | 9 |
static void initFeature() {
Random rand = new Random();
for(int i = 0; i < DataInfo.userNumber; i++)
for(int j = 0; j < DataInfo.featureNumber; j++)
DataInfo.userFeature[i][j] = 0.01 * rand.nextDouble();
for(int i = 0; i < DataInfo.itemNumber; i++)
for(int j = 0; j < DataInfo.featureNumber; j++... | 4 |
@SuppressWarnings({ "rawtypes", "unchecked" })
private final static PrivilegeHolder getPrivilegeHolder(String name, ArrayList privilegeHolders) {
if(name == null || privilegeHolders == null) {
return null;
}
for(PrivilegeHolder privilegeHolder: (ArrayList<PrivilegeHolder>)privilegeHolders) {
if(privileg... | 4 |
private static byte[] getPKCS1BytesFromPKCS8Bytes(byte[] bytes) {
/*
* DER format: http://en.wikipedia.org/wiki/Distinguished_Encoding_Rules
* PKCS#8: http://tools.ietf.org/html/rfc5208
*/
int bIndex = 0;
// Start with PrivateKeyInfo::=SEQUENCE
// 0x30 Sequenc... | 3 |
public Deplacement ProchainDeplacement(int i) {
Deplacement deplacementProchain = null;
Tour touractuelle = null;
int j =0;
for (Tour tour : historiqueToursJoueur) {
touractuelle = tour;
for (Deplacement deplacement : tour.getListDeplacement()) {
j++;
if(j == (i))
{
deplacementProchain =... | 5 |
void close ()
throws USBException
{
if (fd < 0)
return;
try {
// make sure this isn't usable any more
long status = closeNative (fd);
if (status < 0)
throw new USBException ("error closing device",
... | 2 |
private void quickSortMostly0(int[] a, int low, int high) { //the valid elements of the list are [low, high]
if (high - low <= a.length / 10)
return;
int n = high - low; //number of elements in the list.
int p = low + 1; //median of three; pivot's index.
int pivot = a[p]; //... | 7 |
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... | 6 |
public void populateMapWidget()
{
Random ran = new Random();
for (int i=0; i<6; ++i) {
core.Point p = new core.Point(ran.nextInt(getWidth()-6)+3, ran.nextInt(getHeight()));
MapObject o = ran.nextBoolean() ? MapObject.TREE : MapObject.MOUNTAINS;
obstacles.add(p);
mapWidget.objectAt(p.y, p.x).setLayer(2,... | 6 |
public void openImplicitChannel() throws CardException {
if (scpVersion == SCP_02_0A || scpVersion == SCP_02_0B || scpVersion == SCP_02_1A || scpVersion == SCP_02_1B) {
CommandAPDU getData = new CommandAPDU(CLA_GP, GET_DATA, 0, 0xE0);
ResponseAPDU data = channel.transmit(getData);
byte[] result = data.getBy... | 9 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS-... | 8 |
public void actionPerformed(ActionEvent ev)
{
try
{
InstituicaoCooperadora objt = classeView();
if (obj == null)
{
long x = new InstituicaoCooperadoraDAO().inserir(objt);
objt.setId(x);
JOptionPane.showMessageDialog(null,
"Os dados foram inseridos com sucesso", "Sucesso", JOptionPane.INF... | 3 |
@RequestMapping(value = "/addFlashcard", params = {"deckId"}, method = RequestMethod.POST)
public String addFlashcard(
@RequestParam("file") MultipartFile file,
@RequestParam("deckId") int deckId,
@ModelAttribute Flashcard flashcard,
HttpSession session,
Model model) {
if(session.getAttribute("user... | 3 |
public LoadMenu(){
try {
registerFont = Font.createFont(Font.TRUETYPE_FONT, getClass().getClassLoader().getResource("res/narrow.ttf").openStream());
} catch (FontFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
intro = Toolkit.getDefaultToolkit().getImag... | 2 |
@Override
public void configure(AbstractCommand command, String[] args) {
int page = 0;
String search = null;
boolean listReverse = false;
boolean listSimple = false;
if (args.length == 3) {
page = Integer.parseInt(args[0]);
search = args[1];
... | 9 |
@Override
protected Void doInBackground() throws Exception
{
currentPlayer = this;
if (medias.length > 1)
Gui.getInstance().getStopButton().setVisible(true);
for (MediaElement item : medias)
{
if (cancelPlayer)
break;
if (!item.getVisible())
continue;
Stri... | 9 |
public Message build() {
try {
Message record = new Message();
record.to = fieldSetFlags()[0] ? this.to : (java.lang.CharSequence) defaultValue(fields()[0]);
record.from = fieldSetFlags()[1] ? this.from : (java.lang.CharSequence) defaultValue(fields()[1]);
record.body = fieldSetFla... | 4 |
@Override
public void run() {
try {
// Создаём Selector
Selector selector = SelectorProvider.provider().openSelector();
// Открываем серверный канал
ServerSocketChannel serverChannel = ServerSocketChannel.open();
// Убираем блокировку
s... | 9 |
public void update() {
boolean p1ReadyE = false;
boolean p2ReadyE = false;
for (int i = 0; i < model.length; i++) {
if (selection[i] == 1) {
p1ReadyE = true;
p1Character[i].setEnabled(false);
p1Character[i].setBackground(Color.RED);
p2Character[i].setEnabled(false);
p2Character[i].setBackgr... | 9 |
private Object readJSON() throws JSONException {
switch (read(3)) {
case zipObject:
return readObject();
case zipArrayString:
return readArray(true);
case zipArrayValue:
return readArray(false);
case zipEmptyObject:
return new JSONO... | 7 |
public boolean hasPreferences(String module) {
module += '.';
for (Enumeration<Object> keys = mPrefs.keys(); keys.hasMoreElements();) {
String key = (String) keys.nextElement();
if (key.startsWith(module)) {
return true;
}
}
return false;
} | 2 |
public static String[] split(String str, char separatorChar, boolean preserveAllTokens) {
if (str == null) {
return null;
}
int len = str.length();
if (len == 0) {
return new String[0];
}
List<String> list = new ArrayList<String>();
int i = 0, start = 0;
boolean match = false;
boolean lastMatch ... | 9 |
@EventHandler
public void SpiderResistance(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.getSpiderConfig().getDouble("Spider.Resi... | 6 |
public void addAccount(BankAccount account) throws IllegalArgumentException {
if (! canHaveAsAccount(account))
throw new IllegalArgumentException();
accounts.add(account);
} | 1 |
public boolean isDirty() {
getExpression().asString(); // Force resolution of reference.
return super.isDirty();
} | 0 |
public int getX(){
return x;
} | 0 |
private String getDriverProfile() {
/**
* The temporary profile Selenium/Firefox creates should be
* located at java.io.tmpdir. On Windows it is %TEMP%
* Search is based on the presence of the file which name is the same as the name of the profile.
* This file was manually placed in profile directory.
... | 8 |
public static void main(String[] args) {
Application app = Application.get();
if(!app.init()) {
System.out.println("Error with initialization! :(");
System.exit(-1);
}
app.run();
} | 1 |
public List<EventComment> findAfterEventCommentsByHallEventId(final Long hallEventId) {
return new ArrayList<EventComment>();
} | 0 |
public Object getValueAt(int row, int col) {
Account account = accounts.getBusinessObjects().get(row);
if (col == 0) {
return account;
}
if (col == 1) {
if(account==null) return null;
if(account.getType().isInverted())
return account.getSaldo().negate();
else return account.getSaldo();
// TOD... | 4 |
public ArrayList<String> locateAllAt(int p_X, int p_Y) throws Exception
{
String around = "locate(What," + p_X + "," + p_Y + ").";
ArrayList<String> what = new ArrayList<String>();
SolveInfo info = m_Engine.solve(around);
while(info.isSuccess())
{
String... | 2 |
public static void main( String[] args ) throws Exception {
Scanner scanner = new Scanner( System.in );
System.out.println( "Enter grid size:" );
int gridSize = scanner.nextInt();
StringBuilder[] grid = new StringBuilder[gridSize];
System.out.println( "Enter location of text file... | 9 |
@Override
public void unInvoke()
{
final MOB mob=(MOB)affected;
if((canBeUninvoked())&&(mob!=null))
if(mob.location()!=null)
{
mob.location().show(mob,null,CMMsg.MSG_OK_VISUAL,L("<S-NAME> dissipate(s)."));
final Vector<Item> V=new Vector<Item>();
for(int i=0;i<mob.numItems();i++)
V.addElement(mob... | 8 |
public static ValueFormatType fromValue(String v) {
for (ValueFormatType c: ValueFormatType.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} | 2 |
public void readInPupils() throws InvalidDataException {
ArrayList <String> ErrorPupil = new ArrayList();
try {
// TODO code application logic here
Scanner scan = new Scanner(new File("D:/Pupils.csv"));
while (scan.hasNextLine()) {
... | 4 |
public static void main(String[] args) {
int i = 32768;
short s = (short) i;
System.out.println("i = " + i + ", s = " + s); // i = 32768, s = -32768
} | 0 |
public static void main(String[] args) {
WeatherService weatherService = new WeatherService();
Report myReport = weatherService.getReport("newark, de");
List<Forecast> myForecasts = myReport.getForecasts();
System.out.println(myForecasts.size());
Forecast firstForecast = myForeca... | 9 |
private Value term() throws Exception
{
Value previous, rval;
previous = rval = factor();
while(scan.sym == Token.mul || scan.sym == Token.div) {
Token op = scan.sym;
scan.next();
previous = rval;
Value next = factor();
Instruction ins;
... | 3 |
public boolean bootstrap()
{
String userId = node.getUserId();
boolean bootstrapped = false;
System.out.println(userId + " - Bootstrapping...");
if (bootstrapList.isEmpty()) //CA wasn't contacted
{
//bootstrap list is get from formerly known contacts
... | 8 |
private void putCallObj(Long key, IRemoteCallObject object) {
sync.put(key, object);
} | 0 |
public static void main(String[] args) {
Hand p1Hand = findHandFromCardSet(convertToCardSet(args[0].trim(), args[2].trim()));
Hand p2Hand = findHandFromCardSet(convertToCardSet(args[1].trim(), args[2].trim()));
System.out.println("Player one has " + p1Hand.toString());
System.out.println("Player two has " + p2H... | 2 |
ProvinceListDialog(java.awt.Frame parent) {
super(parent, "Provinces", false);
ProvinceData.Province[] provs = Main.provinceData.getAllProvs();
String[][] provNameTable = new String[provs.length][3];
int i = 0;
boolean pti = true;
... | 3 |
private void tryToFall(World var1, int var2, int var3, int var4) {
if(canFallBelow(var1, var2, var3 - 1, var4) && var3 >= 0) {
byte var8 = 32;
if(!fallInstantly && var1.checkChunksExist(var2 - var8, var3 - var8, var4 - var8, var2 + var8, var3 + var8, var4 + var8)) {
EntityFallingSand... | 7 |
public String getType(Symtab st) {
if (exp1Type.equals("message") || exp2Type.equals("message"))
return "message";
if (exp1Type.equals("String") || exp2Type.equals("String"))
return "String";
else if (exp1Type.equals("decimal") || exp2Type.equals("decimal"))
return "decimal";
else
return "int";
} | 6 |
public String POST_Request(String url, String url_params) {
StringBuffer response;
String json_data = "";
HttpsURLConnection con = null;
try {
con = (HttpsURLConnection) set_headers(url);
con.setDoOutput(true);
con.setRequestMethod("POST");
con.setRequestProperty("User-Agent", "Mozilla/5.0 ( compati... | 6 |
public boolean removeAt(int index) {
if (indexOK(index)) {
if (index == 0) {
shiftArrayBy(-1);
} else {
System.arraycopy(array, index + 1, array, index, array.length - index - 1);
expandArrayCapacityBy(-1);
}
return true;
}
return false;
} | 2 |
private void frequencyTable(ServletOutputStream out, TimerInfoStats stats, String sort, String baseurl)
throws IOException {
Set<TimerInfoItem> treeSet;
if ("perf".equalsIgnoreCase(sort)) {
treeSet = new TreeSet<TimerInfoItem>(new AverageComparator());
} else if ("uri".eq... | 7 |
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://do... | 6 |
public boolean isBlack(String dir) throws IOException
{
Vector<String> black_id = new Vector<String>();
List<String> black_edges = getBlackEdges();
if (black_edges != null) {
for(int i=0; i < black_edges.size(); i++) {
String [] vals = black_edges.get(i).split("\\... | 8 |
private final String lock2key(String lock) {
String key_return;
int len = lock.length();
char[] key = new char[len];
for (int i = 1; i < len; i++)
key[i] = (char) (lock.charAt(i) ^ lock.charAt(i - 1));
key[0] = (char) (lock.charAt(0) ^ lock.charAt(len - 1) ^ lock.charAt(len - 2) ^ 5);
for (int i = 0; i <... | 9 |
@Override
public void run() {
String command = "";
while (running) {
try {
if (jLine) {
command = consoleReader.readLine(">", null);
} else {
command = consoleReader.readLine();
... | 5 |
public static void main(String[] args)
{
double ran = Math.random();
if(ran < .33)
{
f = new File("dungeon.wav");
s = new SoundPlayer(f);
} else if (ran > .66)
{
f = new File("angel.wav");
s = new SoundPlayer(f);
} else ... | 5 |
private void setCircleDefault(Attributes attrs) {
// find the value to be set, then set it
if (attrs.getValue(0).equals("fill"))
circleDef.setFill(Boolean.valueOf(attrs.getValue(1)));
else if (attrs.getValue(0).equals("color"))
circleDef.setColor(new Color((Integer.valueOf(attrs.getValue(1)
.substring(... | 9 |
public String strStr_BF(String haystack, String needle) {
if (haystack == null || needle == null)
return null;
char[] h = haystack.toCharArray(), n = needle.toCharArray();
if (h.length < n.length)
return null;
if (n.length == 0)
return haystack;
for ... | 8 |
public static void equipWeapon(WeaponType type, CharacterSheet sheet) {
switch (type) {
case mel_sword:
sheet.atk_dmg = 10;
sheet.damageType = DamageType.SLASHING;
sheet.range = 1;
break;
case rng_bow:
sheet.... | 2 |
@Override
public void update(int delta) {
lifetime += delta;
if(type == ASTEROID)
y += 0.1f * delta;
if(first && lifetime >= MAX_LIFETIME)
isAlive = false;
if(lifetime >= MAX_LIFETIME){
lifetime = 0;
first = true;
if(type == PLAYER)
Game.getPlayer().hide();
}
} | 5 |
private void layoutHorizontal(int top, int bottom, int left, int right) {
int leftX = paddingLeft;
int height = bottom - top;
int childBottom = height - paddingBottom;
int availableHeight = height - paddingTop - paddingBottom;
for (int i = 0; i < getChildCount(); i++) {
... | 6 |
private HashMap<Date, Double> readTideDataFromService() {
// Log a message
logger
.debug("readTideDataFromService called and params are currently :");
logger.debug("-> Location = " + tideLocation);
logger.debug("-> Location URL Fragment = " + tideLocationUrlFragment);
logger.debug("-> Start D... | 9 |
public void clickTutorial() {
System.out.println("Please choose characters that you would like to play with in this game.");
//Plus more info on how the game is played in itself
} | 0 |
static char getOption() {
System.out.print("\tChoose action: ");
System.out.print("(1) students at a school, ");
System.out.print("(2) shortest intro chain, ");
System.out.print("(3) cliques at school, ");
System.out.print("(4) connectors, ");
System.out.print("(q)uit? =>... | 5 |
public void setupMenu(){
edgeDetection = new JMenuItem("Edge Detector");
angle = new JMenuItem("Determine Angle");
threshold = new JMenuItem("Threshold");
topView = new JMenuItem("Add Top View");
lateralView = new JMenuItem("Add Lateral View");
frontView = new JMenuItem("Add Front View");
figureVoxels = ... | 3 |
public boolean peutCreerLien(ZElement elem1, ZElement elem2) {
return super.peutCreerLien(elem1, elem2)
&& (elem1 instanceof MCDAssociation
&& elem2 instanceof MCDEntite || elem2 instanceof MCDAssociation
&& elem1 instanceof MCDEntite);
} | 4 |
public void propertyChange( PropertyChangeEvent evt )
{
if ( evt.getSource() == topPanel )
{
int hash = evt.getPropertyName().hashCode() ;
if ( hash == "reload".hashCode() )
{
loadOptions() ;
}
else if ( hash == "save".hashCode() )
{
saveOptions( true ) ; //... | 4 |
public List<Double> run() {
List<Double> res = new Vector<Double>(ANN.outputNeuronCount);
for (Layer l : layers) {
for (Neuron n : l.getNeurons())
n.preCalc();
}
for (Neuron o : layers.get(layers.size() - 1).getNeurons()) {
res.add(o.getValue());
}
return res;
} | 3 |
public boolean equals(Vector3f r)
{
return m_x == r.GetX() && m_y == r.GetY() && m_z == r.GetZ();
} | 2 |
public String toStringHtmlHeader() {
StringBuilder sb = new StringBuilder();
sb.append("<script type=\"text/javascript\" src=\"http://www.google.com/jsapi\"></script>");
sb.append("<script type=\"text/javascript\"> google.load('visualization', '1', {packages: ['corechart']}); </script>\n");
sb.append("<script t... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Posizione other = (Posizione) obj;
if (x != other.x)
return false;
if (y != other.y)
return false;
return true;
} | 5 |
public void DnaSequenceBaseAt(int len) {
// Create a random sequence
char bases[] = new char[len];
for (int i = 0; i < bases.length; i++) {
char base = GprSeq.BASES[(int) (Math.random() * 4)];
bases[i] = base;
}
String sequence = new String(bases);
DnaSequence DnaSequence = new DnaSequence(sequence);... | 3 |
public void Solve() {
List<Integer> primes = Euler.GetPrimes(_max);
int longestSequence = 0;
int startSequenceIndex = 0;
for (int startIndex = 0; startIndex < primes.size(); startIndex++) {
int currentNumber = primes.get(startIndex);
for (int endIndex = startInde... | 7 |
private final boolean cons(int i)
{ switch (b[i])
{ case 'a': case 'e': case 'i': case 'o': case 'u': return false;
case 'y': return (i==0) ? true : !cons(i-1);
default: return true;
}
} | 7 |
public void run() {
try {
JavaDBAccess = new DatabaseAccess(props);
TARGET_PHP_FILES_RUNS_FUNCTIONS_ID = 0;
long startTime = System.currentTimeMillis();
// client streams (make sure you're using streams that use
// byte arrays, so things like GIF and... | 5 |
private void handleKey(SelectionKey key) throws IOException{
// dealing with canceled keys
if( ! key.isValid() ){
return;
}
KeyAttachment attach = ((KeyAttachment) key.attachment());
IoHandler handler = attach.handler;
if( key.isAcceptable() ){
handler.accept(key);
// keys that are acceptable wil... | 5 |
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.