text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void print() {
int printableHour; // hour value to be printed
String amPm; // am or pm value to be printed
if (error != null) {
System.out.println(error);
} else {
// convert 24h to 12 h
amPm = hour >= 12 ? "PM" : "AM"; // am or pm value to be ... | 4 |
static final public AbstractSyntaxTreeNode<DataTypeEnum,IValue> booleanFactorExpression() throws ParseException {
Token t;
AbstractSyntaxTreeNode<DataTypeEnum,IValue> node;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
t = jj_consume_token(ID);
{if (true) return new Var... | 9 |
protected PoliLine pop(PoliLine master, Point first, Point last) {
Iterator<Point> cursor = master.iterator();
LinkedList<Point> poppedPoints = new LinkedList<Point>();
poppedPoints.add(first);
boolean started = false;
while (cursor.hasNext()) {
Point x = cursor.next();
if (started && x.equals(last))... | 7 |
private boolean callInitMethods(final Plugin spawnedPlugin, final Method[] methods)
throws IllegalAccessException {
log("callinit/start", new OptionInfo("plugin", spawnedPlugin.getClass().getCanonicalName()));
for (final Method method : methods) {
log("callinit/method", new OptionInfo("method", method... | 8 |
public int longestValidParentheses(String s) {
if (s == null || s.length() <= 1) {
return 0;
}
int longest = 0;
int[] longests = new int[s.length()];
longests[s.length() - 1] = 0;
for (int i = s.length() - 2; i >= 0; i--) {
longests[i] = 0;
if (s.charAt(i) == ')') {
longests[i] = 0;
} els... | 8 |
public Object get(){
return stackList.removeLast();
} | 0 |
public static int indexer(char x)throws IllegalLineException{
//takes in a char and returns int to be used for indexing with Expression Checker's dictionary
//throws IllegalLineException when the char is not of expected type
//the final return of 100 is never reached.
switch(x){
case '|':case'&': return 0;
... | 8 |
public void run() {
try {
String line = reader.readLine();
while (line != null) {
if (isErrorStream)
System.err.println(line);
else
System.out.println(line);
line = reader.readLine();
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
} | 3 |
public Temporada buscarTemporada(int idTemporada){
Temporada solucion = null;
for (Temporada temporada : temporadas)
if (temporada.obtenerNumeroTemporada() == idTemporada)
solucion = temporada;
return solucion;
} | 2 |
public int depositAmount(int amount){
if(amount > 0)
{
bal += amount;
System.out.println("\nRs "+amount+" is deposited into your Account");
}
return bal;
} | 1 |
void initBlocks()
{
int xInicial=0;
int yMas=10;
switch(Level)
{
case 1:
xInicial=(screenWidth-(Block.width*VBlocks))>>1;
break;
case 2:
case 3:
xInicial=Block.width>>1;
}
for(int x=0;x<VBlocks;x++)
{
int yTmp=yMas;
for(int y=0;y<HBlocks;y++)
{
blocks[x][y]=new Block(... | 7 |
protected void processGlobalResourceARList(Sim_event ev)
{
LinkedList regionalList = null; // regional GIS list
int eventTag = AbstractGIS.GIS_INQUIRY_RESOURCE_AR_LIST;
boolean result = false;
// for a first time request, it needs to call the system GIS first,
// then asks... | 6 |
public MultiBufferTest(int numBuffers, GraphicsDevice device) {
try {
GraphicsConfiguration gc = device.getDefaultConfiguration();
mainFrame = new Frame(gc);
mainFrame.setUndecorated(true);
mainFrame.setIgnoreRepaint(true);
device.setFullScreenWindow(mainFrame);
if (device.isDisplayChangeSupported()... | 6 |
public void run(){
// If there is not word to recognized or the word is empty then do not recognize
if(word == null || word.trim().isEmpty()){
return;
}
// Get the highlighter
DefaultHighlighter.DefaultHighlightPainter highLighter = FileUtils.getInstance().getHighligh... | 7 |
public static Shape getShape(String color) {
Circle circle = (Circle) circleMap.get(color);
if (circle == null) {
circle = new Circle(color);
circleMap.put(color, circle);
System.out.println("Creating Circle of " + color + " color.");
}
return circle;
} | 1 |
*/
private int stepCalc(int range) {
if (range < 10) {
return 1;
}
if (range < 20) {
return 2;
}
if (range < 50) {
return 5;
}
if (range < 100) {
return 10;
}
if (range < 250) {
return 25;
}
if (range < 500) {
return 50;
}
return 100;
} | 6 |
public int getAmountOfCitys(){
return amountOfCitys;
} | 0 |
public static void main(String[] args) throws SecurityException {
System.out.println(System.getProperty("java.runtime.version"));
SecurityManager testManager = System.getSecurityManager();
if (testManager == null)
{
//final Unsafe unsafe = Unsafe.getUnsafe();//Doesn't work - protected to throw a security er... | 6 |
protected boolean test3 () { return true; } | 0 |
public void shiftLeft() {
point.setLocation(location);
point.translate(-1, 0);
if (assertLegal(pane, block, point, block, location)) {
free();
location.translate(-1, 0);
calcShadowDrop();
draw();
}
} | 1 |
public HashMap<BasicMana, Integer> getMap() {
HashMap<BasicMana, Integer> temp = new HashMap<BasicMana, Integer>();
if (this.black > 0) {
temp.put(BasicMana.BLACK, this.black);
}
if (this.blue > 0) {
temp.put(BasicMana.BLUE, this.blue);
}
if (this.red > 0) {
temp.put(BasicMana.RED, this.red);
}
... | 6 |
public int setxattr(ByteBuffer path, ByteBuffer name, ByteBuffer value, int flags, int position) {
if (xattrSupport == null) {
return handleErrno(Errno.ENOTSUPP);
}
String pathStr = cs.decode(path).toString();
String nameStr = cs.decode(name).toString();
if (log != ... | 4 |
public String getShortestExample(Boolean accept) {
String path = "";
Queue<ArrayList<Integer>> holder = new LinkedList();
List<ArrayList<Integer>> visited = new LinkedList();
Map<ArrayList<Integer>, ArrayList<Integer>> vertmap = new HashMap<ArrayList<Integer>, ArrayList<Integer>>();
... | 9 |
public void releaseBuffer(ByteBuffer bb){
if(this.createCount.intValue() > maxBufferPoolSize && (this.usableCount.intValue() > (this.createCount.intValue() / 2) ) ){
bb = null;
this.createCount.decrementAndGet();
}else{
this.queue.add(bb);
this.usableCount.incrementAndGet();
}
} | 2 |
private void loadConfig(){
properties[0] = "left";
properties[1] = "right";
properties[2] = "up";
properties[3] = "down";
properties[4] = "protect";
properties[5] = "shoot";
properties[6] = "shoot2";
properties[7] = "sound";
if(file.canRead())
try {
fstream = new FileInputStream(f... | 8 |
public void commit(){
Point p = GUI.getMousePosition();
if(GridWorldLife.brush){
Location l = GUI.panel.locationForPoint(p);
if((prevLoc != null && !prevLoc.equals(l)) || prevSize != GridWorldLife.brushSize){
stroke(l, GridWorldLife.brushSize);
prevLoc = l;
prevSize = GridWorldLife.brushSize;... | 4 |
public DebateGUI(User user, Debate debate) {
super("Debate");
this.userLogin = user;
this.debateSelected = debate;
String[][] team = debateSelected.getTeam();
for (int i = 0; i < team.length; i++) {
for (int j = 0; j < team[i].length; j++) {
if (team[i][j].equals(userLogin.getName())) {
if ( i == ... | 4 |
private static void launchServer() throws IOException {
InetSocketAddress addr = new InetSocketAddress(Integer.valueOf(conf.getProperty(PORT)));
HttpServer server = HttpServer.create(addr, 0);
server.createContext("/", new HttpHandler() {
public void handle(HttpExchange exchange... | 4 |
@SuppressWarnings("unchecked")
@Override
public int compareTo(Node o) {
int toReturn;
if (o == null) {
toReturn = -1;
} else if (c == null && o.c == null) {
toReturn = 0;
} else if (c == null) {
toReturn = 1;
} else if (o.c == null) {
toReturn = -1;
} else {
toReturn = ((Compar... | 5 |
private void read(DataInputStream in) throws IOException {
accessFlags = in.readUnsignedShort();
name = in.readUnsignedShort();
descriptor = in.readUnsignedShort();
int n = in.readUnsignedShort();
attribute = new LinkedList();
for (int i = 0; i < n; ++i)
attri... | 1 |
public int findIndexOfFileDescriptor(String filename, boolean delete) throws Exception {
for(int i = 0; i < 3; i++){
if(oft.readDiskToBuffer(0, i) == -1)
throw new Exception("Block not assigned");
byte[] memory = oft.getBuffer(0);
for(int j = 0; j < memory.length; j = j + DIRECTORY_ENTRY_S... | 8 |
private List<LogicCell> next() {
List<LogicCell> resultList = new ArrayList<>();
for (LogicCell cell : currentStep) {
cell.neigbour = 0;
nextStep.put(cell, cell);
}
for (LogicCell c : currentStep) {
addNeighbors(c);
}
for (LogicCell cel... | 8 |
public void render(Graphics g) {
for (int y = 0; y < slots[0].length; y++) {
slots[slots.length - 1][y].render(g);
}
if (Main.screen.game.invOpen())
for (int y = 0; y < slots[0].length; y++) {
for (int x = 0; x < slots.length; x++) {
if (x != slots.length - 1)
slots[x][y].render(g);
}
... | 5 |
public void SetEngine(CoreEngine engine)
{
if(this.m_engine != engine)
{
this.m_engine = engine;
for(GameComponent component : m_components)
component.AddToEngine(engine);
for(GameObject child : m_children)
child.SetEngine(engine);
}
} | 3 |
public String getUsername()
{
return new String(probeData).trim();
} | 0 |
public void setLevel(int lvl){
if(Engine.DEBUG_MODE)
this.stats[PROGRESSION] = lvl;
rebuildStats();
} | 1 |
String unqualReason() {
String reason = "";
if (!this.qualifyTest()) {
reason = "Unqualified Reasons:\n";
}
if (this.getMajorCrd() < 45) {
reason = reason + "Less than 45 Major Credits\n";
}
if (this.getUpperCrd() < 45) {
reason = reason... | 6 |
public final void setBiomeID(byte biomeID){
if(currentChunk == null)return;
currentChunk.setBiomeID((int)getX(), (int)getZ(), biomeID);
} | 1 |
@Override
public void rightMultiply(IMatrix other) {
// TODO Auto-generated method stub
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
copy[i][j]=0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
for (int k = 0; k < 4; k++) {
copy[i][j]=copy[i][j] + this.get(k, i) * other.get(j, k... | 7 |
@Override
public void mousePressed(MouseEvent ev) {
if (ev.getButton() == MouseEvent.BUTTON1 && !ev.isPopupTrigger() && !(ev.isShiftDown() && ev.isControlDown())) {
if ((ev.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK || (ev.getModifiers() & InputEvent.ALT_MASK) == InputEvent.ALT_MASK) {
Lis... | 9 |
private void flush() {
if (logWriter != null) {
logWriter.flush();
}
if (errorLogWriter != null) {
errorLogWriter.flush();
}
} | 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 fe... | 6 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(otherSide)
return true;
if(msg.target()==affected)
{
if(!(affected instanceof MOB))
return true;
if((msg.source()!=msg.target())
&&(msg.tool() instanceof Abili... | 7 |
public static void binarySearch(int[] arr, int data) {
if (arr.length < 1) {
System.out.println("null?");
return;
}
if (arr.length == 1) {
if (data == arr[0]) {
System.out.println("success.\t" + data + " -> arr[0]");
return;
... | 6 |
private boolean checkCommand(){
try{
CommandScanner commandscanner = new CommandScanner(StockGameCommandType.values(), descriptor);
commandscanner.checkCommandSyntax(shellreader);
return true;
}catch(WrongCommandException e){
shellwriter.println("Invalid Command");
shellwriter.flush();
return ... | 2 |
public double weightedStandardDeviation_of_ComplexRealParts() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
boolean hold2 = Stat.nEffOptionS;
if (nEffReset) {
if (nEffOptionI) {
Stat... | 7 |
public Object getField(Reference ref, Object obj)
throws InterpreterException {
Field f;
try {
Class clazz = TypeSignature.getClass(ref.getClazz());
try {
f = clazz.getField(ref.getName());
} catch (NoSuchFieldException ex) {
f = clazz.getDeclaredField(ref.getName());
}
} catch (ClassNotFou... | 5 |
void calcGravityForce() {
double scalar;
double dist;
for(int i = 0; i < mass.length; i++) {
dist = distances[i].length();
if(Math.abs(dist) > 0.001) {
scalar = PhysConstantEnum.gravitationalConstant.value() * weight * mass[i] /
(dist * dist * dist);
distances[i].scalarMul((float)scalar);
... | 2 |
private void drawArena()
{
drawArenaLine(Engine.NUM_COLUMNS);
for(int y=Engine.NUM_LINES; y>=0; y--)
{
Util.print('#');
for(int x=0; x<Engine.NUM_COLUMNS; x++)
{
if( e.getCobra().isPosTrue(x,y) ) // Cobra
Util.print('-');
else if( e.getTocaPermanente().isPosTrue(x,y) ) // Toca Permanente... | 6 |
@Override
public int getScore(String p) {
if(p.equals(player1)) {
return this.score1;
}
else if (p.equals(player2)) {
return this.score2;
}
return 0;
} | 2 |
public void setLeft(PExp node)
{
if(this._left_ != null)
{
this._left_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Clause other = (Clause) obj;
if (literals == null) {
if (other.literals != null)
return false;
} else if (!literals.equals(other.literal... | 6 |
protected boolean DelAccount(String accountFile, String id) throws ClassNotFoundException, IOException{
ArrayList<Account> accs = new ArrayList<Account>();
Account tempacc = null;
ArrayList<Account> newaccs = new ArrayList<Account>();
try {
obji = new ObjectInputStream(new FileInputStream(accountFile));
o... | 6 |
@Basic
@Column(name = "PCA_USUARIO")
public String getPcaUsuario() {
return pcaUsuario;
} | 0 |
private boolean checkPsd() throws IOException {
byte[] a = new byte[24];
if (read(a) != a.length) {
return false;
}
final byte[] PSD_MAGIC = {0x50, 0x53};
if (!equals(a, 0, PSD_MAGIC, 0, 2)) {
return false;
}
format = FORMAT_PSD;
width = getIntBigEndian(a, 16);
height = getIntBigEndian(a, 12);
... | 5 |
private static double computeCrc(int[][] squares) {
//calculate CR
double numerator = 0; //start by computing the numerator
for (int row = 0; row < 4; row++) {
double pi = 0; //nb of dots in this row divided by total number of dots
for (int col = 0; col < 4; col++) {
pi += squares[row][col];
... | 6 |
private void send(String message, boolean isText) {
if (message.equals(""))
return;
if (isText) {
message = client.getName() + ": " + message;
message = "/m/" + message;
}
client.send(message.getBytes());
txtMessage.setText("");
} | 2 |
private boolean freeSpace() {
for (int i = 0; i < components.getLength(); i++) {
if (dropArea.intersects(components.get(i))) {
JOptionPane.showMessageDialog(this, FREE_SPACE);
return false;
}
}
return true;
} | 2 |
public void fDistributionProbabilityPlot(int nu1, int nu2){
this.lastMethod = 15;
// Check for suffient data points
this.fDistributionNumberOfParameters = 0;
if(this.numberOfDataPoints<3)throw new IllegalArgumentException("There must be at least three data points - prefe... | 2 |
public int getItemIcon(ItemStack par1ItemStack, int par2)
{
int var3 = super.getItemIcon(par1ItemStack, par2);
if (par1ItemStack.itemID == Item.fishingRod.shiftedIndex && this.fishEntity != null)
{
var3 = par1ItemStack.getIconIndex() + 16;
}
else
{
... | 8 |
public static void main(String[] args) {
Random rnd = new Random();
System.out.println("------------------------------------");
System.out.println("Demo class java.util.Random");
System.out.println("------------------------------------");
// rnd.nextInt(MAX) +1 = generer un nombre aleatoire entre 1 et MAX.
... | 7 |
public boolean newUser(User usertemp){
if(logUser(usertemp) == true)
return false;
return userList.add(usertemp);
} | 1 |
protected void log(String text, LogLevel logLevel) {
if (verbosity == LogLevel.ALL || logLevel == LogLevel.ERROR)
super.log(text);
else {
if (logLevel == verbosity)
super.log(text);
}
} | 3 |
public synchronized boolean replaceAllPossibleFailingParts(WorkSheet ws) {
if (ws.partsToReplace == null) {
// nothing to replace
ws.status = WorkSheet.Status.FINISHED;
return true;
}
for (Iterator<Part> it = ws.partsToReplace.iterator(); it.hasNext();) {
Part partToReplace = it.next();
PartType ty... | 6 |
public static List<String> getAllLines(File file) throws IOException
{
List<String> strings = new ArrayList<String>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
} catch (FileNotFoundException e1) {}
String line;
try {
while ((line = reader.readLine()) != ... | 3 |
private void killEnemy(EnemyShip enemy) {
remaining--;
if (enemy.wasKilledByPlayer()) {
score += enemy.getScoreValue();
killedInLevel++;
ScorePopup popup = new ScorePopup(screen, enemy);
popup.setWorld(this);
if (level.isLastWave() && killedInL... | 4 |
public static void export(ArrayList<HashSet<Integer>> clusterList) {
try {
File csv = new File("D:\\File\\Dropbox\\Project\\minHashedAuthors.csv");
try (BufferedWriter bw = new BufferedWriter(new FileWriter(csv, true))) {
bw.newLine();
bw.write("aid" + ","... | 4 |
public void removeEmployee(int id){
for(int i = 0; i < numEmployees; i ++){
if(employees[i].getId() == id){
for(int j = i; j < numEmployees; j ++){
employees[j] = employees[j+1];
}
numEmployees--;
}
}
} | 3 |
public void addDataPoints(String group, DataPoints dp)
{
if (dp==null || dp.isEmpty()) return;
group = group.toLowerCase();
if (!this.m_PointsSet.containsKey(group))
{
this.m_PointsSet.put(group, dp);
} else
{
for (DataPoint p: dp)
this.m_PointsSet.get(group).addPoint(p.getX(), p.getY());
}
... | 4 |
public boolean canDo(char symbol) {
if (symbol == '{') return true;
return false;
} | 1 |
public double getDouble(Object key) {
Number n = get(key);
if (n == null) {
return (double) 0;
}
return n.doubleValue();
} | 1 |
public boolean isFresh() {
return (this.lastAnnounce != null &&
(this.lastAnnounce.getTime() + FRESH_TIME_SECONDS * 1000 >
new Date().getTime()));
} | 1 |
public String login(HttpServletRequest req, HttpServletResponse resp) {
try {
String queryString = req.getQueryString();
String name = queryString.split("&")[0];
String password = queryString.split("&")[1];
name = name.substring(10, name.length());
password = password.substring(14, password.length()... | 4 |
@Override
public void update() {
if (doc.isShowingAttributes()) {
AttributeContainer node = doc.tree.getEditingNode();
model.keys.clear();
model.values.clear();
model.readOnly.clear();
clearSelection();
Iterator it = node.getAttributeKeys();
if (it != null) {
while (it.hasNext()) {
... | 4 |
public void move(int xa, int ya) {
if(xa > 0) dir = 1;
if(xa < 0) dir = 3;
if(ya > 0) dir = 2;
if(ya < 0) dir = 0;
if(!collision()) {
x += xa;
y += ya;
}
} | 5 |
@Override
public void mouseReleased(MouseEvent me) {
int x = me.getX();
int y = me.getY();
if (this.drawable != null) {
// 最初の位置から変化があった場合のみmoveコマンドを実行する.
if (!((x == this.startX) && (y == this.startY))) {
// undoができるようにmoveコマンドを生成して実行する.
// undoした時にはドラッグの開始位置に戻すために,一旦,最初の位置まで... | 4 |
public void actionPerformed(ActionEvent e){
String[] sa=new String[4];
if(e.getSource()==jbanalizar||e.getSource()==jmi1){
String cadaux=pa.getJtatexto().getText();
alva.analizar(cadaux);
if(tam>=0){
for(int i=0;i<tam;i++){
pa.getJttabla().setValueAt("",i,0);
pa.getJttabla().setValueAt("",i,1... | 8 |
public static void main(String[] args) {
// Объявим конcтанту для размера массива
int SIZE = 5;
// Создаем массив, в котором есть другие массивы
// Причем массивы не создаются - они равны NULL
char[][] graph = new char[SIZE][];
// Цикл по элементам массива - все они по... | 3 |
public void draw(Graphics g, Display d, int bottomPixelX, int bottomPixelY) {
if(filter != null){
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(image, filter, bottomPixelX-image.getWidth(null)/2, bottomPixelY-image.getHeight(null));
} else {
Image i = getImage(d.getRotation());
if(i != null){
g.dra... | 5 |
public static boolean isRobotSafe(URL url) {
String strHost = url.getHost();
// form URL of the robots.txt file
String strRobot = "http://" + strHost + "/robots.txt";
URL urlRobot;
try {
urlRobot = new URL(strRobot);
} catch (MalformedURLException e) {
// something weird is happening, so don't trust ... | 7 |
public ArrayList<E>floyd (E saleDe, E vaA){
int[][] path=hacerMatrizPath();
for(int i=0; i<cantNodos; i++){
for(int j=0; j<cantNodos; j++){
System.out.print(path[j][i]+" ");
}
System.out.println("\n");
}
System.out.println("\n");
... | 7 |
public Object[] formatoTabela(Pesquisa pesquisa)
{
return new Object[] { pesquisa.getId(), pesquisa.getTitulo(),
pesquisa.getOrientador(),
pesquisa.getPesquisadorResponsavel(),
pesquisa.getColaboradores(), pesquisa.getAnoSubmissao(),
pesquisa.getTempoDuracao(), pesquisa.getTipo(),
pesquisa.getQua... | 1 |
public ListNode reverseBetween(ListNode head, int m, int n) {
if (head == null || head.getNext() == null || m == n) {
return head;
}
//create a preHead to comtrol the head node
ListNode preHead = new ListNode(0);
preHead.setNext(head);
head = preHead;
... | 6 |
private void analyseEndian(String line) throws AssemblerException {
if (line.trim().length() == 0)
return;
if(foundEndian)
throw new AssemblerException("Endian error: Endian already specified.");
foundEndian = true;
line = line.trim();
line = line.toLowerCase();
if (line.equals("big"))
data.s... | 4 |
protected static Ptg calcLog( Ptg[] operands ) throws CalculationException
{
if( operands.length < 1 )
{
return PtgCalculator.getNAError();
}
double[] dd = PtgCalculator.getDoubleValueArray( operands );
if( dd == null )
{
return new PtgErr( PtgErr.ERROR_NA );//20090130 KSC: propagate error
}
if( ... | 4 |
private void initialize(Frame header)
throws DecoderException
{
// REVIEW: allow customizable scale factor
float scalefactor = 32700.0f;
int mode = header.mode();
int channels = mode==Frame.SINGLE_CHANNEL ? 1 : 2;
// set up output buffer if not set up by client.
if (output==null)
output =... | 3 |
@Override
public void removeProductType(ProductType productType) {
tx.begin();
for (SubProcess sp : productType.getSubProcesses()) {
for (Stock s : sp.getStocks()) {
sp.removeStock(s);
}
em.merge(sp);
em.remove(sp);
}
em.remove(productType);
tx.commit();
} | 2 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Point point = (Point) o;
if (Double.compare(point.x, x) != 0) return false;
if (Double.compare(point.y, y) != 0) return false;
return ... | 5 |
@Override
public void run() {
this.Run = true;
while(Run)
{
try {
Thread.sleep(this.Intervall);
} catch (InterruptedException e) {
e.printStackTrace();
}
this.Panel.repaint();
this.Panel.Update();
... | 2 |
public static void main(String[] args)
{
if(args == null || args.length < 1)
{
System.err.println
("usage: java org.mcuosmipcuter.dog4sql.text.RandomWordFactory <length> [allowed] [disallowed]");
System.exit(1);
}
String rw = "";
try
{
if(args.length == 1)
rw = getRandomWord(Integer.parseInt... | 6 |
private int chkMycrds(){
int myrnk=0;
if(crd1!=null&&crd2!=null){
myrnk+=crd1.getRankID();
myrnk+=crd2.getRankID();
if(crd1.getRankID()==crd2.getRankID()){
myrnk+=40;
}else if(crd1.getRankID()-1==crd2.getRankID()||crd1.getRankID()+1==crd2.getRankID()){
myrnk+=20;
}
if(crd1.getSuitID()==cr... | 8 |
public void body()
{
// wait for a little while
// This to give a time for GridResource entities to register their
// services to GIS (GridInformationService) entity.
super.gridSimHold(GridSim.PAUSE);
LinkedList resList = super.getGridResourceList();
// initialises a... | 5 |
public static Population evolvePopulation(Population pop)
{
Population newPopulation = new Population(pop.size(), false);
// Keep our best individual
if (elitism)
{
newPopulation.saveIndividual(0, pop.getFittest());
}
// Crossover population
int elitismOffset;
if (elitism)
{
elitismOffset = 1... | 4 |
public static int max_min_number(int[][] grid) {
int path[][] = new int[grid.length][grid[0].length];
int col, row;
row = grid.length;
col = grid[0].length;
path[0][0] = grid[0][0];
for (int i = 1; i < row; i++)
path[i][0] = Math.min(path[i-1][0],grid[i][0]);
for (int j = 1; j < col; ... | 4 |
public Object readConst(final int item, final char[] buf) {
int index = items[item];
switch (b[index - 1]) {
case ClassWriter.INT:
return new Integer(readInt(index));
case ClassWriter.FLOAT:
return new Float(Float.intBitsToFloat(readInt(index)));
case ClassWriter.LONG:
return new Long(readLong(index)... | 5 |
public void makePowerups()
{
Random rand = new Random();
/*Clear the powerup vector*/
powerups.clear();
/*Go through every brick and check which bricks should contain powerups*/
for(Brick brick : bricks)
{
/*The brick should contain a powerup*/
if(rand.nextFloat() <= POWERUP_PROB)
{
/*A... | 6 |
protected void readAttributes(XMLStreamReader in)
throws XMLStreamException {
String newTypeId = in.getAttributeValue(null, "unit");
if (newTypeId == null) {
newUnitType = null;
} else {
newUnitType = getSpecification().getType(newTypeId, UnitType.class);
... | 6 |
private static HashMap<String, List<Integer>> getTaxaMap( int level) throws Exception
{
HashMap<String, List<Integer>> map = new HashMap<String, List<Integer>>();
BufferedReader reader = new BufferedReader(new FileReader(new File(
ConfigReader.getGoranOct2015Dir() + File.separator +
"PC_0016 Metagenomics ... | 7 |
@Override
public void setAllMap(Map<? extends K, ? extends Collection<? extends V>> map) {
for (Map.Entry<? extends K, ? extends Collection<? extends V>> en : map.entrySet()) {
setAll(en.getKey(), en.getValue());
}
} | 7 |
final void close() throws IOException {
if (!closed) {
if (fieldsStream != null) {
fieldsStream.close();
}
if (isOriginal) {
if (cloneableFieldsStream != null) {
cloneableFieldsStream.close();
}
if (cloneableIndexStream != null) {
cloneableIndexS... | 6 |
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.