text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public String cyclify() {
if (isMetaVariable) {
return META_VARIABLE_PREFIX + name;
} else {
return NORMAL_VARIABLE_PREFIX + name;
}
} | 1 |
@Override
public void keyReleased(KeyEvent e) {
if(e.getComponent() != null)
if(e.getComponent().getName().equals("codeBoxEdit")) if(isLiveDecode()) parent.executeCiphers();
} | 3 |
public void visiteur() {
this.getCtrlPrincipal().action(EnumAction.MENU_VISITEUR);
} | 0 |
public void movePointer(Utility.Direction dir){
pointerY += dir.getDeltaY();
pointerX += dir.getDeltaX();
pointerY = pointerY < 0 ? 0 : pointerY > (items.size()-1)/columns ? (items.size()-1)/columns : pointerY;
pointerX = pointerX < 0 ? 0 : pointerX > columns-1 ? columns-1 : pointerX;
... | 4 |
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
char[] str = input.nextLine().toCharArray();
for (int i = 0; i < str.length;i++) {
for (int j = 0; j < str.length; j++) {
for (int j2 = 0; j2 < str.length; j2++) {
System.out.println(""+str[i]+str[j]+str[j2]);
}... | 3 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... | 9 |
public int work(float[] buffer) throws AOException {
returned = this.previous[0].nextWork(buffer);
if (this.inputs == 2) {
if (tmp == null || tmp.length != buffer.length) {
tmp = new float[buffer.length];
} else for (index = 0; index < tmp.length; index++) {
... | 7 |
public static IFuzzyCommand parse(String line) throws FuzzyParserException {
if(line == null) {
throw new FuzzyParserException("The command string must not be null!");
}
IFuzzyCommand command = null;
line = line.replaceAll(",\\s+", ",");
line = line.replaceAll("write", "w write");
line = line.repla... | 9 |
public boolean match(Sim_event ev)
{
if (ev == null) {
return false;
}
boolean result = false;
try
{
// find an event with a matching tag first
if ( tag_ == ev.get_tag() )
{
Object obj = ev.get_data();
... | 5 |
public String getChefVente() {
return chefVente;
} | 0 |
public static void entryMode(int a) { // assign cursor moving direction and enable the shift of entire display
if (a == 1) {
io.iowrite(6,(short)0x6); //cursor moves to right and DDRAM address is increased by 1
}
if (a == 2) {
io.iowrite(6,(short)0x4); //cursor moves to left and DDRAM address is decreased ... | 4 |
public static char stringToCharacter(String name) {
{ char renamed_Char = name.charAt(0);
if (name.length() > 1) {
if (Stella.stringEqlP(name, "SPACE")) {
renamed_Char = ' ';
}
else if (Stella.stringEqlP(name, "LINEFEED")) {
renamed_Char = '\n';
}
e... | 9 |
public static boolean equals(Object obj1, Object obj2) {
if ((obj1 == null) && (obj2 == null)) {
return true;
} else if ((obj1 == null) || (obj2 == null)) {
return false;
} else {
return obj1.equals(obj2);
}
} | 4 |
public void tick() {
if (input.attack.clicked || input.menu.clicked) {
game.setMenu(parent);
}
} | 2 |
@Override
public void run() {
ObjectInputStream in = null;
ObjectOutputStream out = null;
try {
in = new ObjectInputStream(this.socket.getInputStream());
out = new ObjectOutputStream(this.socket.getOutputStream());
} catch (IOException e) {
e.print... | 9 |
private void botonBorrarPersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBorrarPersonaActionPerformed
borrando = true;
DefaultTableModel modelo = ((DefaultTableModel) jTable.getModel());
int fila = jTable.getSelectedRow();
//Eliminamos esa persona de la list... | 1 |
private static byte[] getSubBusAndCheck(HDLTokenizer input, String pinName, int busWidth)
throws HDLException {
byte[] result = null;
try {
result = getSubBus(pinName);
} catch (Exception e) {
input.HDLError(pinName + " has an invalid sub bus specification");
... | 6 |
@Override public boolean equals(Object obj) {
if( !(obj instanceof Client.UIState) ) return false;
Client.UIState o = (Client.UIState)obj;
return
(scene == o.scene || (scene != null && scene.equals(o.scene))) &&
(stats == o.stats || (stats != null && stats.equals(o.stats))) &&
textMessages.equa... | 8 |
public void preencherTabela() throws Exception
{
ArrayList<String> colunas = new ArrayList<String>();
colunas.add("id");
colunas.add("nome");
Object linhas[][] = new Object[list.size()][];
int i = 0;
for (AreaFormacao areaformacao : list)
{
linhas[i] = formatoTabela(areaformacao);
i++;
}
view.g... | 3 |
public static void toggleEditableInheritance(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
JoeNodeList nodeList = tree.getSelectedNodes();
for (int i = 0, limit = nodeList.size(); i < limit; i++) {
toggleEdi... | 3 |
protected void playerInitialize() {
try {
audioDevice = FactoryRegistry.systemRegistry().createAudioDevice();
InputStream stream = getClass().getResourceAsStream(filePath);
player = new AdvancedPlayer(stream, audioDevice);
player.setPlayBackListener(this);
... | 1 |
public static void main(String[] args) {
IntSet set = new IntSet();
for (int i = 2; i < 10; i += 2) {
set.add(i);
}
for (int i = 1; i < 9; i++) {
System.out.print(i + "-" + set.isMember(i) + " ");
}
// 3. Clients ask the collection object to creat... | 4 |
public boolean checkUser(Client c){
for(Client tempc: usershere){
if(tempc.equals(c)){
return true;
}
}
return false;
} | 2 |
public static HelperConfig loadConfig(String configPath, String appName) {
Document doc = XmlTools.initDocument(configPath);
if (doc==null
//TODO Use a better validate path
// || !XmlTools.validateXml("./HelperConfiguration.xsd", configPath)
)
return null;
Element rootElement = doc.getDocumentElement(... | 9 |
public boolean hitLeft()
{
if(nextX() <= xMin)
return true;
return false;
} | 1 |
private void display() {
blitNumber((int) totalFps, 5, 2);
blitNumber((int) lastPps, 5, 12);
if (!openGL) {
if (!fullscreen) {
buffer.display(gFrame, leftBorderWidth, titleBarHeight);
} else {
Graphics g=bufferStrategy.getDrawGraphics();
g.drawIma... | 2 |
public boolean add(String tableName, List<String> args) throws DataBaseTableException {
Table table = tableHashMap.get(tableName);
if (table == null) {
throw new DataBaseTableException("no such table");
}
return table.add(args);
} | 1 |
public void gameStateChangeListener(GameLogic.GameState state) {
switch(state) {
case PLAYING:
//audioPlayer.stop(currentMusic);
clearScreens();
addScreen(GameplayScreenFactory.create());
audioPlayer.playMusic("gameplay", true);
... | 3 |
public final void clearOldNodes(int i) {
if (Class142_Sub8_Sub31.softReferenceFactory != null) {
for (ReferenceHolder referenceHolder = (ReferenceHolder) list.getTail(); referenceHolder != null; referenceHolder = (ReferenceHolder) list.getPrev()) {
if (referenceHolder.isSoft()) {
... | 5 |
@Override
protected void generateTheory(InputStream ins) throws ParserException {
try {
if (null == theoryUnmarshaller) theoryUnmarshaller = XjcUtilities.getTheoryUnmarshaller();
Theory cTheory = (Theory) theoryUnmarshaller.unmarshal(ins);
theory = new spindle.core.dom.Theory();
ruleCounter = 0;
th... | 7 |
public static void main(String[] args) {
Random r = new Random();
DelayQueue<Student> students = new DelayQueue<Student>();
ExecutorService exec = Executors.newCachedThreadPool();
for(int i = 0; i < STUDENT_SIZE; i++){
students.put(new Student("学生" + ( i + 1), 3000 + r.nextIn... | 1 |
@Override
public void run() {
if (logger.isLoggable(Level.FINEST)) {
logger.finest("Starting row diff change processor");
}
while (true) {
try {
IRow r = queue.take();
if (r instanceof PoisonRow) {
... | 7 |
public SpriteSheet(String path) {
BufferedImage image = null;
try {
image = ImageIO.read(SpriteSheet.class.getResource(path));
} catch (IOException e) {
e.printStackTrace();
}
if (image == null) {
return;
}
this.path = path;
this.width = image.getWidth();
this.height = image.getHeight()... | 2 |
public int reductionLigne() {
int sommeRegret = 0;
int min;
for(int i = 0; i < this.getTaille(); i++) {
min = this.getValue(i, 0);
if(i == 0) {
min = this.getValue(i, 1);
}
for(int j = 0; j < this.getTaille(); j++) {
if(this.getValue(i, j) != -1) {
min = (this.getValue(i, j) < min)?... | 7 |
@Override
public Object clone() {
DefaultInferenceParameters copy = new DefaultInferenceParameters(cycAccess);
Iterator<CycSymbol> iterator = this.keySet().iterator();
while (iterator.hasNext()) {
CycSymbol key = iterator.next();
Object value = this.get(key); // note: this might should be clon... | 1 |
private ArrayList<Integer> primes(int pos){
if(pos>31) throw new RuntimeException("primes not defined to go that large\nset to less than 32");
if(pos<1) throw new RuntimeException("No valid moves specified in primes\nset to more than 0");
ArrayList<Integer> out = new ArrayList<Integer>();
if(bitTest(pos... | 7 |
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String action = request.getParameter("act");
if(action != null) {
try {
RequestContext context = new RequestContext(request);
if(context.isLogged(... | 5 |
@EventHandler
public void onConnectionEvent(ConnectionEvent event){
try{
if(!IPMap.put(event.getSocketChannel().getLocalAddress())){
try{
event.getSocketChannel().socket().getOutputStream().write(new String("We Are Full!").getBytes());
event.getSocketChannel().socket().getOutputStream().flush();
... | 3 |
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
square = new Rectangle2D.Double(0, 0, this.getWidth() - 1,
this.getHeight() - 1);
squareInside = new Rectangle2D.Double(1, 1, this.getWidth() - 3,
this.getHeight() - 3);
g2d = (Graphics2D) g;
g2d.setPaint(StockState.getColor... | 1 |
@Override
public boolean equals(R2DType type)
{
if(type == null)
return false;
if(!type.name.equals(name) || !(type instanceof R2DTypeVec2D))
return false;
Vector2 otherData = ((R2DTypeVec2D)type).data;
if((data == null && otherData != null) || (otherData == null && data != null))
return false;
re... | 7 |
public void strikeByObject(int ap, int weight, int vecX, int vecY) {
if (dead) {
return;
}
// 迥カ諷九↓繧医k繝�Γ繝シ繧ク螟牙喧
if(wet) {
ap *= 1.5;
}
if(isHasPants()) {
ap *= 0.8;
}
// 蜷ケ縺」鬟帙�險ュ螳�
// 菴馴㍾蟾ョ
int kick = (weight - getWeight()) / 100;
if(kick < 1) kick = 1;
//System.out.println(vecX+","+v... | 6 |
private FileDescriptor(final FileDescriptorProto proto,
final FileDescriptor[] dependencies,
final DescriptorPool pool)
throws DescriptorValidationException {
this.pool = pool;
this.proto = proto;
this.dependencies = dependencie... | 7 |
private boolean jj_3_46() {
if (jj_3R_58()) return true;
return false;
} | 1 |
public void setNumInt(TNumInt node)
{
if(this._numInt_ != null)
{
this._numInt_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... | 3 |
protected void onRender(GraphicsHelper gh) {
Rectangle r = new Rectangle(xOnView(pos.x),yOnView(pos.y),s,s);
gh.drawRectangleGradient(r,cBgTop.multiply(color),cBgTop.multiply(color),cBgBottom.multiply(color),cBgBottom.multiply(color));
gh.g().setColor(cBorder.multiply(color));
gh.g().draw(r);
float mult... | 5 |
public int dit(Model model){
int res = 0;
for(Generalization g : model.getGeneralization()){
for(String str : g.getArrayIdent()){
if(str.equals(this.identifier)){
res = cheminPlusLongVersRacine(model, g);
}
}
}
//System.out.println(res);
return res;
} | 3 |
public boolean isAdjacent(Position position, double radius) {
if(this.isImpassable(position, radius))
return false;
double step = 0.1 * radius;
double checkingWidth = 1.1*radius;
double startRow = (position.getY() - checkingWidth);
double startColumn = (position.getX() - checkingWidth);
double endRow ... | 8 |
private static int updateStarts(int base, int[] values, int[] starts) {
int start = base;
for (int i = 0; i < values.length; i++) {
starts[i] = start;
start += values[i];
}
return start - base;
} | 1 |
@Override
public void actionPerformed(final ActionEvent e) {
if (e.getSource() instanceof Button) {
this.handleButtton(e);
}
else if (e.getSource() instanceof Menu) {
this.handleMenu(e);
}
else if (e.getSource() instanceof MenuItem) {
this.handleMenuItem(e);
}
else if (e.getSource() instanceof T... | 6 |
public boolean freqDecision (int freq,int centreFreq,boolean inv) {
if (inv==false) {
if (freq>centreFreq) return true;
else return false;
}
else {
if (freq>centreFreq) return false;
else return true;
}
} | 3 |
public final Color getColor() {
return color;
} | 0 |
@Override
protected boolean doInsertAfter(IProcessComponent<?> component, IProcessComponent<?> predecessor) {
int index = components.indexOf(predecessor);
if (index == -1) {
return false;
}
add(index + 1, component);
return true;
} | 3 |
public void letClientsThink(){
try {
Thread.sleep(roundTimeMilliseconds); // 1000
}
catch (InterruptedException e){
Debug.warn("INTERRUPTED!");
}
} | 1 |
public void init() {
String colorstr = getParameter("pagecolor");
if (colorstr == null)
colorstr = "ffffff";
this.pageColor = new Color(Integer.parseInt(colorstr, 16));
colorstr = getParameter("bgcolor");
if (colorstr != null)
setBackground(new Color(Integer.parseInt(colorstr, 16)));
String cp = getPa... | 4 |
public String dump() {
String dump = "";
for (int i = 0; i < grid.length; i++) {
for (int j = 0; j < grid[0].length; j++) {
dump += grid[i][j] ? 'O' : '.';
}
dump += "\n";
}
return dump;
} | 3 |
private ArrayList<String>[] partArrays(ArrayList<String> tmp) {
int count = 0;
// Nombre de noeuds disponibles
for (boolean bool : nodeDispo) {
if (bool) count++;
}
System.out.println("count = "+count);
// On redivise le travail non fait
@SuppressWarnings("unchecked")
ArrayList<String> res[] = new ... | 4 |
public void insert(Persist persist) {
String sql = "insert into SaleItems (SaleId, ItemCode, Name, Price, Quantity, SupplierCode, BumonCode) "
+ "values (?, ?, ?, ?, ?, ?, ?)";
persist.executeUpdate(sql,
getSaleid(), getItemcode(), getName(), getPrice(), getQuantity(), ge... | 0 |
private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... | 8 |
public void login_function() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
//READ HIERARCHY FROM DATABASE AND DECIDE ON FUNCTION--||
Class.forName("com.mysql.jdbc.Driver").newInstance();
Statement s = GUI.con.createStatement();
s.executeQuery ("SELECT Hierarchy, ... | 7 |
@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 AriadnaMember)) {
return false;
}
AriadnaMember other = (AriadnaMember) object;
if ((this.memberId == null && o... | 5 |
private Rectangle deserializeWindowPosition(final Locatable window) {
final String positionString = appProperties.getProperty(window.getName());
// Exit
if (positionString == null) {
log.debug("The position of the window {} is not saved in the properties file.",
window.getName());
return null;
}
... | 3 |
@Override
public void setPosition(Integer startNode, Integer finalNode, AggregatePositioner source)
{
if (startNode != null)
getStartNodeValueLabel().setText(startNode.toString());
else
getStartNodeValueLabel().setText("Not set");
if (finalNode != null)
getFinalNodeValueLabel().setTex... | 9 |
private void checkValidContent(Iterator<Cell> cellIterator, Row row, int flag) {
if (flag == OK_PRINT) {
while (cellIterator.hasNext() && this.copyCellContent) {
Cell cell = cellIterator.next();
// Condição parada de leitura do arquivo.
if (row.getC... | 6 |
public ListNode deleteDuplicates(ListNode head) {
ListNode temp = head;
if (head == null){
return head;
}
while(temp.next!=null){
if (temp.val == temp.next.val){
if( temp.next.next!=null){
temp.next = temp.next.next;
... | 5 |
public static int skipType(String methodTypeSig, int position) {
char c = methodTypeSig.charAt(position++);
while (c == '[')
c = methodTypeSig.charAt(position++);
if (c == 'L')
return methodTypeSig.indexOf(';', position) + 1;
return position;
} | 2 |
public void alimentaTabelaVeiculo(String SQL){
ArrayList dados = new ArrayList();
String [] Colunas = new String[]{"Placa","Marca","Modelo","Ano","AnoModelo","Cor","Chassis","Decric.","Status","Valor/Dia"};
connVeiculo.executaSQL(SQL);
try {
... | 2 |
protected double[] svmlightToArray(String row) throws Exception {
double[] result;
StringTokenizer tok;
int index;
int max;
String col;
double value;
// actual data
try {
// determine max index
max = 0;
tok = new StringTokenizer(row, " \t");
tok.nextToken(... | 8 |
public String getAttackSpot(double defendersDefSkill,String aim) {
setRealSkills();
double proficency=0;
if(attackStyle.equals("handToHand")){proficency=getHandToHand();}
double diff= ((getAttSkill()-defendersDefSkill)/2.0)+((3*proficency)/20.0);
double legs;double arms;
double torso;doub... | 9 |
public static void CreateWindow(int width, int height, String title)
{
try
{
Display.setTitle(title);
Display.setDisplayMode(new DisplayMode(width, height));
Display.create();
Keyboard.create();
Mouse.create();
}
catch (LWJGLException e)
{
e.printStackTrace();
}
} | 1 |
private static void printFileWriters(String prefix, Map<String, FileWritingMessageHandler> fileWriters) {
Assert.notNull(fileWriters, "Mandatory argument missing.");
for (String key : fileWriters.keySet()) {
FileWritingMessageHandler writeTarget = fileWriters.get(key);
File out... | 2 |
public static void main(String[] args) {
try {
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
handleException(e);
}
})... | 1 |
public double slopeTo(Point that)
{
double x0 = this.x;
double y0 = this.y;
double x1 = that.x;
double y1 = that.y;
if (x0 == x1 && y0 == y1)
{
return -1.0/0.0;
}
else if (y0 == y1)
{
return 0;
}
else if (x0 == x1)
{
return 1.0/0.0;
}
else
{
return (y1-y0)/(x1-x0);
}
/*... | 4 |
public WebDriver getDriver(String browser, String url) {
if(browser.equalsIgnoreCase("chrome")){
System.setProperty("webdriver.chrome.driver", "C:/Users/Gufran/Desktop/Documents/PeoplenTech Documents/Class Notes(03-29-14) on Selenium-JAVA/chromedriver.exe");
wd = new ChromeDriver();
... | 4 |
private void button2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button2MouseClicked
if(numberofpins < 4)
{
if(numberofpins == 0)
{
Login_form.setString1("9");
}
if(numberofpins == 1)
{
Login_form.setString2("9");
}
if(numberofpins == 2)
{
Login_... | 5 |
private void acceptButtonUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptButtonUpdateActionPerformed
boolean error = false;
String errorString = "";
Object[] what = new Object[7];
what[0] = enabledConectionUpdate.isSelected();
if (!userUpdateData.ge... | 8 |
public Edge getEdge( int toID ){
for( Edge edge : edges ){
if( edge.to == toID){
return edge;
}
}
return null;
} | 2 |
public void karteAuslesen(){
for(int x = 0;x<karte.getWidth();x++){
for(int y = 0;y<karte.getHeight();y++){
Color c = new Color(karte.getRGB(x,y));
if(c == grass){
tileIDs[x][y]=0;
}else if(c == sand){
tileIDs[x][y]=1;
}else if(c == busch){
tileIDs[x][y]=2;
}else if(c == stein){
... | 7 |
public String getGearbox() {
return gearbox;
} | 0 |
public void restoreScreen() {
Window window = device.getFullScreenWindow();
if (window != null) {
window.dispose();
}
device.setFullScreenWindow(null);
} | 1 |
private Point ySearchFirstPoint(Point startPoint) {
Point currPoint = new Point(startPoint.x, startPoint.y);
while (startPoint.dF * currPoint.dF > 0) {
if (currPoint.y <= yNull) {
currPoint.setY(currPoint.y + 1);
} else {
break;
}
... | 3 |
public static String updateUser(String userString)
{
userString = userString.substring(6);
int id = Integer.parseInt(userString.split("\\\\")[0]);
String username = userString.split("\\\\")[1];
if(username.charAt(0) == '"')
username = username.substring(1, username.length()-1);
String outputStr = "";
... | 3 |
public void setConstants(final Constant[] constants) {
this.constants = new ArrayList(constants.length);
for (int i = 0; i < constants.length; i++) {
this.constants.add(i, constants[i]);
}
} | 1 |
private void jEnableBtnActionPerformed(java.awt.event.ActionEvent evt) {
if (!enabled) {
robotInstance.getPacketTransmitter().setEnabled();
jEnableBtn.setText("Disable");
jRoboStatus.setText("Broadcasting (Enabled)");
enabled = true;
}
else {
robotInstance.getPacketTransmitter().setDisabled();
... | 1 |
public Expense findLowestPriority()
{
Expense lowest;
if(m_expenses.size() > 0)
{
lowest = m_expenses.get(0);
for(int i = 0; i < m_expenses.size(); ++i)
{
Expense compare = m_expenses.get(i);
if(compare.getPriority() < lowest.getPriority())
{
lowest = compare;
}
}
}
else
l... | 3 |
public static JFileChooser konfiguriereFileChooser(final boolean save)
{
final JFileChooser fileChooser = new JFileChooser("./level/");
fileChooser.setFileFilter(new FileFilter()
{
@Override
public String getDescription()
{
return "Zuul-Level";
}
@Override
public boolean accept(File arg0)... | 3 |
private static Type decodeType(int dataType) throws IOException {
Type result;
switch (dataType) {
case 0: result = Type.U8; break;
case 1: result = Type.STRING; break;
case 2: result = Type.U16; break;
case 3: result = Type.U32; break;
case 4: result = Type.X8; ... | 7 |
public Playfield(int nagents, double dt, int ddt) {
DT = dt;
DDT = ddt;
agents = new Agent[nagents];
for (int i = 0; i < nagents; i++)
do
agents[i] = new Bug(this, "Bug " + i);
while(collision(agents[i], false));
} | 2 |
public Facility(EnumFacilityType type, Corporation owner, Planet location){
this.type = type;
this.owner = owner;
this.location = location;
name = location.getName()+type.toString();
switch(type){
case ELECTRONICSPLANT: inputs.add(EnumResource.CIRCUITRY); output=EnumResource.ELECTRONICS; productionTime=... | 9 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
return result;
} | 3 |
public HangmanState(Set<String> knownWords) {
/* initialize answer */
int index = (int) (Math.random() * knownWords.size());
Iterator<String> itr = knownWords.iterator();
for (int i = -1; i < index - 1; i++) {
itr.next();
}
this.theAnswer = itr.next();
this.lettersGuessed = new HashSet<String>();
S... | 4 |
public static void setArgParam(String key, String value) {
if(key.equals("traffic_pattern")) {
setParam(key, TrafficType.valueOf(value.toUpperCase()));
}
else if(key.equals("routing")) {
setParam(key, RoutingType.valueOf(value.toUpperCase()));
}
else if(key.equals("faults")) {
setParam(key, ... | 8 |
Space[][] getOpenSets(Space sp) {
Space[][] sets = new Space[getNumOpenSets(sp)][3];
int index = 0;
if (getNumOpenSets(sp) != 0) {
if (isOpenForPiece(board[sp.getX()], sp.getPiece())) {
sets[index] = board[sp.getX()];
index++;
}
if (isOpenForPiece(getColumn(sp.getY()), sp.getPiece())) {
sets[... | 7 |
public void extractExample(String zipFilePath, String saveFileDir) {
File file = new File(zipFilePath);
if (file.exists()) {
InputStream is = null;
ZipArchiveInputStream zais = null;
try {
is = new FileInputStream(file);
zais = new ZipArchiveInputStream(is);
ArchiveEntry archiveEntry = null;
... | 8 |
private static boolean dayView(Calendar cal, DateTime d) {
Event[] events = cal.getDay(d);
if (events == null) {
return false;
}
//30 spaces across
String title = "Events for " + d.getMonth() + "-" + d.getDay();
String spacer = "---------------------------------------------";
int x = 45 - title.lengt... | 8 |
@Override
public void storeTrays(List<Tray> trays, Stock destination) {
Iterator<StorageUnit> i = destination.getStorageUnitsIterator();
while (i.hasNext()) {
StorageUnit unit = i.next();
for (int taken = unit.getTrays().size(); taken < destination
.getMaxTraysPerStorageUnit(); taken++) {
Tray tray ... | 3 |
public void colocarObjetos(Snake s,Presa pre)
{
tab=new int[filas][columnas];
Punto p=pre.ub;
tab[p.y][p.x]=PRESA;
// p=s.vibora.get(0);
for(int i=0;i<s.vibora.size();i++)
{
p=s.vibora.get(i);
if(i==0)
{
//Colocar la Cabeza
tab[p.y][p.x]=CABEZA;
}else if(i==s.vibora.size()-1)
{
... | 3 |
public void request()
{
this.preReques(); //在真实角色操作之前所附加的操作
if(null == realsubject)
{
realsubject = new RealSubject();
}
realsubject.request(); //真是角色所完成的事情
this.postRequest(); //在真实角色操作之后附加的操作
} | 1 |
protected final synchronized String readLineL(){
String line="";
try{
line = input.readLine();
}catch(java.io.IOException e){
System.out.println(e);
}
if(line==null){
if(!th... | 3 |
public void updatePosition() {
if (position.mX < destination.mX) position.mX++;
else if (position.mX > destination.mX) position.mX--;
if (position.mY < destination.mY) position.mY++;
else if (position.mY > destination.mY) position.mY--;
if (position.mX == destination.mX && po... | 7 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.