text stringlengths 14 410k | label int32 0 9 |
|---|---|
private int evalState(State s) {
int score = evalStateSide(s, "red") - evalStateSide(s, "blue");
return (me == "red")?score:-score;
} | 1 |
public String Encrypt(String text)
{
BigInteger m = new BigInteger(this.pkcs1pad2(text.getBytes(), this.GetBlockSize()));
if (m.equals(Zero))
{
return null;
}
BigInteger c = this.DoPublic(m);
if (c.equals(Zero))
{
return null;
}
String result = c.toString(16);
if ((result.length... | 3 |
public void append(String msg) {
if (win==true){textarea.append(msg+"\n");}
else{System.out.println(msg);}
} | 1 |
private String tellLoca(String lineName) {
String direct = "{";
switch (lineName) {
case "line one" :
direct = direct + "turn left from canteen main entrance, and use the farrest stairs to go up";
break;
case "line two" :
direct = direct + "turn left from canteen main entrance, and use the nearer stairs... | 9 |
public static void main(String[] args) {
int[] chainLength = new int[1000000];
for (int i = 0; i < chainLength.length; i++)
chainLength[i] = 0;
chainLength[1] = 1;
long next;
for (int i = 2; i < chainLength.length; i++) {
next = i;
int length = 0;
while (next != 1 && next >= i) {
if (next % ... | 7 |
private static int decode4to3(
byte[] source, int srcOffset,
byte[] destination, int destOffset, int options ) {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Source array was null." );
} // end if
... | 8 |
public static boolean checkAuth(byte [] authenticatorclient,String account,String password,String timestamp) {
try {
String clientstr =Hex.rhex(authenticatorclient);
String serverstr = Hex.rhex(GenerateAuthenticatorClient(account, password,timestamp));
if (clientstr.equals(serverstr)){
return true;
... | 2 |
public StringSplitter(String text, String match) {
this.matchLength = match.length();
this.text = text;
this.match = match;
if ((text == null) || (text.equals(""))) {
hasMore = false;
}
} | 2 |
private static void polthierAndRumpf(Component4D component,
Map<Integer, Point3D> newPoints, Date date) {
Map<Integer, List<Point3D>> pointTubes = component.getPointTubes();
LinkedList<Date> timesteps = component.getTimesteps();
timesteps.add(date);
Iterator<Integer> it = newPoints.keySet().iterator();
... | 8 |
@Override
public void addQuestAnswer(String answ) {
} | 0 |
private static void printResultByLv(Scanner scan){
while (true) {
System.out.println();
System.out.println("Please choose a level:");
System.out
.println("--------------------------------------------------------------------------------");
//Print all levels by order from LEVEL enumeration.
int i =... | 6 |
public SetModeSpinningUp(){
super(Color.SPINNING_UP);
} | 0 |
public Player(TileMap tm) {
super(tm);
width = 30;
height = 30;
cwidth = 20;
cheight = 20;
moveSpeed = 0.3;
maxSpeed = 1.6;
stopSpeed = 0.4;
fallSpeed = 0.15;
maxFallSpeed = 4.0;
jumpStart = -4.8;
stopJumpSpeed = 0.3;
facingRight = true;
health = maxHealth = 5;
fire = maxFire = 2500;
... | 4 |
@Override
public List<Centre_coworking> cercaAvancada(String nom, boolean banys, boolean cafe, boolean internet, boolean salaReunions, String poblacio) {
Session session = sessionfactory.getCurrentSession();
Criteria criteria = session.createCriteria(Centre_coworking.class);
List<Centre_coworking> centrelist;
... | 6 |
public boolean yesOrNot() {
boolean returning;
int countOnes = 0;
int countZeros = 0;
if (Configuration.isDebugMode()) {
System.out.println("Evaluate true/false value");
}
if ((subDimension.getHeight() != 0) && (subDimension.getWidth() != 0)) {
f... | 9 |
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
try {
//cargo Parametros del Reporte
generarTabla();
Map parametros = new HashMap();
parametros.put("name_empresa", r_con.getRazon_social()... | 6 |
public boolean contensDependente(String nomeDependente){
for(String d: dependentes){
if( d.equalsIgnoreCase(nomeDependente) ){
return true;
}
}
return false;
} | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Tag other = (Tag) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (val... | 9 |
public ArithmeticResult comuteFunctionCall(String funcName,
ArrayList<ArithmeticResult> argumentList, Block codeBlock) {
// Predefined func
if (funcName.equals("InputNum")) {
codeBlock.putInputFuncCode();
return new ArithmeticResult(new SSAVar(Instruction.getPC()));
} else if (funcName.equals("OutputNum"... | 5 |
protected void extractPack(String in, String out) throws Exception
{
File f = new File(in);
FileOutputStream fostream = new FileOutputStream(out);
JarOutputStream jostream = new JarOutputStream(fostream);
Pack200.Unpacker unpacker = Pack200.newUnpacker();
unpacker.unpack(f, jostream... | 0 |
private ActionListener acaoCBOrdenacao() {
ActionListener action = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int indice = cbOrdenacao.getSelectedIndex();
ArrayList<Atracao> lstOrdenada;
switch (indice) ... | 8 |
public FrameCreateAlgo(){
super("Create algo...");
initialize();
} | 0 |
private void init() {
if (defaultRadioButtonBackground == null)
defaultRadioButtonBackground = getBackground();
if (defaultRadioButtonForeground == null)
defaultRadioButtonForeground = getForeground();
popupMouseListener = new PopupMouseListener(this);
addMouseListener(popupMouseListener);
setOpaque(fal... | 8 |
public void streamFile(File file, DataOutputStream outStream) throws IOException {
System.out.println("FILE STREAMING");
long fileSize = file.length();
long completed = 0;
int step = 150000;
outStream.flush();
System.out.println("FILE STREAMING2");
... | 1 |
public void render(Graphics g) {
g.drawImage(Draw.bg, 0, 0, null);
// if (time>100){
// WordsYo(msg, g, 160 , 140 - (int) (Math.abs(Math.sin(time * 0.05) *
// 10)));
// }
int xs = 0;
int ys = msg.length + 3;
for (int y = 0; y < msg.length; y++) {
int s = msg[y].length();
if (s > xs)
xs = s;
... | 6 |
static final void method1971(int i, String string, boolean bool,
int i_11_) {
anInt9942++;
Class59_Sub1_Sub1.method556(false);
Class341.method2681(9864);
Class348_Sub22.method2959(-1);
Class348_Sub23.method2965(string, i_11_, bool, i ^ i);
Class348_Sub24.method2994(2);
VarpHandler.method1311(5139, Class348_... | 5 |
public static boolean checkEntry(int[][] M,int i,int j){
boolean valid = false;
int[][] indexes = new int[4][2];
indexes[0][0] = i-1;
indexes[0][1] = j;
indexes[1][0] = i;
indexes[1][1] = j+1;
indexes[2][0] = i+1;
indexes[2][1] = j;
indexes[3][0] = i;
indexes[3][1] = j-1;
for(int[] index:indexes){... | 6 |
public void createIndex() throws IOException {
validate();
String tweet = null;
TweetProcessor tweetProcessor = new TweetProcessor(indexFolder, dumpFile);
BufferedReader dumpReader = new BufferedReader(new FileReader(dumpFile));
while((tweet = dumpReader.readLine()) != null)... | 2 |
public void markCompletelyDirty(JComponent c) {
// do nothing
} | 0 |
private PMap<Object, Object> addPrimitive(Class<?> bClass, PMap<Object, Object> map) {
if (bClass == Integer.class) {
map = map.plus(Integer.TYPE, bClass);
}
if (bClass == Long.class) {
map = map.plus(Long.TYPE, bClass);
}
if (bClass == Byte.class) {
... | 9 |
protected void internalUpdate(Widget widget, Object element,
String[] properties) {
boolean needsRefilter = false;
if (properties != null) {
for (int i = 0; i < properties.length; ++i) {
needsRefilter = needsRefilter(element, properties[i]);
if (needsRefilter) {
break;
}
}
}
if (needsR... | 8 |
@Override
public ResultMessage insertCollectionOrPaymentPO(CollectionOrPaymentPO receipt) throws RemoteException {
// TODO Auto-generated method stub
boolean isGet = false ;
int i = -1 ;
if(receipt.getNumber().substring(0,3).equals("SKD") )
i = 1 ;
for(TransferListItemPO theItem:receipt.ge... | 5 |
@Override
public void run() {
console.displayMessage("Server thread started");
try {
console.displayMessage("Starting...");
while (true) {
for (int i = 0; i < clients.size(); i++) {
NetworkMessage tmp = clients.get(i).readMessage();
if (tmp != null) {
manageMessage(clients.get(i).getID(),... | 5 |
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
switch (qName) {
case "GeoObject":
geoObject = new GeoObject();
break;
}
} | 1 |
public void normalTarget(){
JFrame frame = new JFrame("Normal Mode");
frame.setVisible(true);
frame.setSize(500,500);
frame.setBackground(color);
panel = new JPanel();
panel.setBackground(color);
final JButton first = new JButton();
first.setBackground(Color.WHITE);
first.setLocation(50+ran... | 8 |
public int getGreen(int x, int y) {
int value = 0;
if ((x >= 0) && (y >= 0) && (x < im.getWidth()) && (y < im.getHeight())) {
value = ((im.getRGB(x, y) >> 8) & 255);
}
return value;
} | 4 |
public void separateAlpha(int[] buffer, int len) {
for (int i = 0; i < len; i++) {
if ((buffer[i] & 0xff000000) != 0) {
buffer[i] = buffer[i] & 0xff000000
| Math.min((buffer[i] >>> 16 & 0xff) * 255 / (buffer[i] >>> 24), 255) << 16
| Math.min((buffer[i] >>> 8 & 0xff) * 255 / (buffer[i] >>> 24), 255)... | 2 |
public List<GrouponResponse> getOffers(RequestBean request, int requiredNoOfOffers)
throws InvalidRequestParametersException, CitysearchException {
validate(request);
Properties properties = PropertiesLoader.getAPIProperties();
StringBuilder urlStringBuilder = new StringBuilder(
... | 7 |
int getContentX (int columnIndex) {
int minX = parent.getCellPadding ();
if (columnIndex == 0) {
Rectangle checkboxBounds = getCheckboxBounds ();
if (checkboxBounds != null) {
minX += checkboxBounds.width + CTable.MARGIN_IMAGE;
}
}
if (parent.columns.length == 0) return minX - parent.horizontalOffset; /* ... | 5 |
protected void initialize() {} | 0 |
@Override
public synchronized Message process(ClientState state, Message request) {
// Read in the Request
if (!parseMessage(request)) {
//return failure
return null;
}
//Check for missing or invalid parameters
if (myQuestion.equals("")) //missing question
return writeFailureResponse("No question... | 7 |
private String makeUnicodeCharactersEscaped(String str) {
StringBuilder b = new StringBuilder();
for (char c : str.toCharArray()) {
if ((1024 <= c && c <= 1279) || (1280 <= c && c <= 1327) || (11744 <= c && c <= 11775) || (42560 <= c && c <= 42655)) {
b.append("\\u").append(... | 9 |
public void removePoller(PollItem item_)
{
PollItem item = item_;
Iterator<SPoller> it = pollers.iterator();
while (it.hasNext()) {
SPoller p = it.next();
if (item.equals(p.item)) {
it.remove();
dirty = true;
}
}
... | 4 |
public final int partitionByName(int lb, int ub)
{
Product pivotElement = allProducts[lb]; // store the left most value as the pivot element
int max = logicalSize;
int left = lb, right = ub; // store left and right as the unchanging values of lb and ub respectively. This is used for the final move of this metho... | 8 |
public void initialise(World world) throws PatternFormatException
{
String[] cellParts = cells.split(" ");
for (int i=0;i<cellParts.length;i++)
{
char[] currCells = cellParts[i].toCharArray();
for (int j=0;j<currCells.length;j++)
{
if (currCells[j] != '1' && currCells[j] != '0') ... | 5 |
public Category getById(int id) throws SQLException {
Session session = null;
Category cat = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
cat = (Category) session.load(Category.class, id);
} catch (Exception e) {
JOptionPane.showMessa... | 3 |
public int execute(Instruction inst) {
this.inst = inst;
InstructionType type = inst.get_type();
int format = inst.get_format();
switch (format) {
case 0:
if (r_format())
return result;
break;
case 1:
if (memory_format())
return result;
break;
case 2:
if (memory_format())
ret... | 9 |
@Override
public boolean doSmall() {
if (!script.houseTask.isInHouse()) {
if (locationAttribute.getSmallRandom(ctx).matrix(ctx).reachable()) {
script.housePortal.enterPortal();
} else {
ctx.movement.findPath(locationAttribute.getSmallRandom(ctx)).traverse();
}
if (Condition.wait(new Callable<Bo... | 4 |
synchronized void notifyListeners(Key key, boolean pressed) {
HashSet<OnToggleListener> tmpList = (HashSet<OnToggleListener>) onToggleListeners.clone();
for (OnToggleListener listener : tmpList) {
listener.onToggle(key, pressed);
}
} | 1 |
private Assert()
{
super();
} | 0 |
public String getCodigoLinea(int index){
if (index > 0) {
return lineas.get(index-1).getcIata();
}
return "";
} | 1 |
public boolean isPermitted(String command, String subcommand) {
if (player == null) {
return true;
}
if (plugin.getPluginManager().getPermissions() != null) {
if (subcommand != null) {
return plugin.getPluginManager().getPermissions().has(player, "XcraftGate." + command
+ "." + subcommand);
... | 4 |
private static void loadCurio() {
try {
FileInputStream fstream = new FileInputStream("curio.conf");
InputStreamReader in = new InputStreamReader(fstream, "UTF-8");
BufferedReader br = new BufferedReader(in);
String strLine;
while ((strLine = br.readLine()) != null) {
String[] info = strLine.split(... | 7 |
private void resolveImports(ModuleManager moduleManager) {
autoImportModules(moduleManager);
for (Import importEntry : this.imports) {
ModuleDefinition dependencyModule = null;
if (moduleManager != null) {
dependencyModule = moduleManager.getModule(importEntry.getName());
}
... | 7 |
@Override
public void deserialize(Buffer buf) {
name = buf.readString();
worldX = buf.readShort();
if (worldX < -255 || worldX > 255)
throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255... | 4 |
public boolean hasCycle(ListNode head) {
ListNode fast = head;
ListNode slow = head;
if (head == null)
return false;
if (head.next == null)
return false;
while (fast.next != null && fast.next.next != null) {
slow = slow.next;
fast = fast.next.next;
if (slow == fast)
return true;
}
... | 5 |
private static void SLDouble(Player P)
{
ShippingLines SL = (ShippingLines)Game.fields.get(P.Position);
int Owner = SL.Owner;
if (Owner != Game.players.indexOf(P))
{
if ((Game.players.get(Owner)).InPrison == false)
{
int cnt = ... | 6 |
@Test
public void insertTest() {
for (int i = 1; i < 10; i++) {
int[] inserts = initializeRandomTable(10000 * ((int) Math.pow(2, i) / 4));
printTime(testPriorityQueueInserts(inserts));
printTime(testBinaryHeapInserts(inserts));
}
} | 1 |
@Before
public void init() {
parkBoy = new ParkBoy();
parkBoy.handlePark(new Park(this.FIRST_PARK_SIZE));
parkBoy.handlePark(new Park(this.SECOND_PARK_SIZE));
} | 0 |
public void testConstructor_RD_RI5() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Duration dur = new Duration(-1);
try {
new Interval(dur, dt);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
private boolean searchSubMenu(String searchString)
{
final String resultFormatString =
"%s. [%s] Name: %s";
if (searchString.matches("\\s*\\v*")) {
return true;
}
int resultIndex = 1;
String type = "Book";
for(Book li : library.s... | 5 |
public List<JAXBElement<ReferenceType>> getDataReferenceOrKeyReference() {
if (dataReferenceOrKeyReference == null) {
dataReferenceOrKeyReference = new ArrayList<JAXBElement<ReferenceType>>();
}
return this.dataReferenceOrKeyReference;
} | 1 |
public static void main(String[] args) {
// TODO Auto-generated method stub
func = ScoreFunctionFactory.getScoreFunction(mode);
int suffix = 0;
if (ROOTDIR.equals("/home/graveendran/Downloads/DUC")) {
suffix = 1;
}
if (mode == ScoreFunctionFactory.Mode.KLSUM) {
((KLSumPlusScoreFunction) func)
... | 7 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
setEnabled(false);
addActionListener(this);
Outliner.documents.addTreeSelectionListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
} | 0 |
public static ArrayList<Staff> getAll() {
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<Staff> staffList = new ArrayList<Staff>();... | 5 |
private void save(prRegion pr) {
File f = new File(plugin.getDataFolder(), "saves/" +pr.getWorld() + "/" + pr.getName()+".fr");
if (!f.exists()) {
f.getParentFile().mkdirs();
try {
f.createNewFile();
} catch (Exception e) {}
}
try {
GZIPOutputStream gzipo = new GZIPOutputStream(new FileOutputStr... | 3 |
public Flags() throws IOException
{
System.out.print("Do you want to override the global flags for this module?");
if (askBoolean())
{
System.out.println("Give the global overriding compiler flags");
System.out.print("Leave blank and hit return to skip this option");
global_override_compiler_flags = ask... | 7 |
public void start() {
LOGGER.info("Starting MaintenanceServer version " + SOFTWARE_VERSION);
long start = System.currentTimeMillis();
if (((Boolean) this.options.valueOf(USE_CONFIG))) {
this.propertyHandler = new PropertyHandler(new File(getRoot(), "maintenance-server.properties"));... | 2 |
public void moveEntity(Entity entity, int xEnd, int yEnd) throws Exception{
if(!containedEntities.contains(entity)){
throw new Exception("The entity: "+entity.toString()+" is not located on this map.");
}
if(gameMap[entity.getXTileCoordinate()][entity.getYTileCoordinate()] != entity){
throw new Exception("... | 5 |
public Number multiplyNumbers(Number a, Number b)
throws NumberClassNotFoundException {
Number product = null;
if (a instanceof Double && b instanceof Double) {
product = new Double(roundDouble(a.doubleValue() * b.doubleValue()));
} else if (a instanceof Integer && b instanceof In... | 8 |
private void _drawRect(Graphics2D g2, int x, int w, Color hiCol,
Color mdCol, Color loCol) {
Dimension d = getSize();
// Divide height into quarters
int h = (int) d.getHeight();
int th = h / 4;
GradientPaint p1;
GradientPaint p2;
ButtonModel model = getModel();
// Paint shaded area
if (!model.isEn... | 3 |
public void setRatingId(int ratingId) {
this.ratingId = ratingId;
} | 0 |
public static boolean isActive(Block block) {
if (!isApplicable(block)) return false;
TileEntityBeacon beacon = (TileEntityBeacon) ((CraftWorld) block
.getWorld()).getHandle().getTileEntity(block.getX(),
block.getY(), block.getZ());
Field active = null;
try {
active = TileEntityBeacon.class.getDeclar... | 5 |
private void adjustScale(double v, double theta)
{
int i = 0;
while (i < _launchVelocity.length && theta > _launchAngle[i])
i++;
if (i == 0)
i = 1;
double temp = v / _launchVelocity[i-1];
// avoid setting velocity to NaN
... | 8 |
public static boolean gameOver(Board board){
if (board.whoWon() != null) {
System.out.println("\n" + board.whoWon() + " won the game!");
System.out.println("Wining move: " + board.getWinningMove());
System.out.println(board);
Integer winCount = gamesT... | 4 |
public int pointToSymbol(int midCount) {
int low = 0;
int high = TOTAL_INDEX;
while (true) { // binary search returns when it finds result
int mid = (high+low)/2;
if (_count[mid] > midCount) {
if (high == mid) --high;
else high = mid;
} else if (_count[mid+1] > midCount) {
return (mid==EO... | 6 |
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
if (event.getBlock().getState() instanceof Sign) {
Sign sign = (Sign) event.getBlock().getState();
if (sign.getLine(1).startsWith("Game ") && sign.getLine(2).cont... | 5 |
@Override
public void mouseEntered(MouseEvent e)
{
if(e.getSource().equals(btnStation) || e.getSource().equals(btnSortCentreEntrance) || e.getSource().equals(btnSortCentreExit) || e.getSource().equals(btnJunctionPoint) || e.getSource().equals(btnConveyor))
{
if(!m_currentlyAdding)
... | 7 |
private void generatePowerFailures() {
for (int x = 0; x < grid.width; x++) {
for (int y = 0; y < grid.height; y++) {
if (Math.random() * 100 <= CHANCE) {
// Generate the Primary PowerFailure
final Position primaryPos = new Position(x, y);
if (grid.validPosition(primaryPos)) {
final ... | 6 |
private void buildHorizontalRoads() {
// Add Horizontal Roads
_horizontalRoads = new VehicleAcceptor[_gridDimensions.getRow()][_gridDimensions.getColumn()+1];
//[row][column]
for (int i=0; i<_gridDimensions.getRow(); i++) {
for (int j=0; j<=_gridDimensions.getColumn(); j++) {
VehicleAcceptor l ... | 2 |
public void removeAllRows(){
int rowCount= getRowCount();
System.out.println(rowCount);
for(int i = rowCount - 1; i >=0; i--)
{
removeRow(i);
}
} | 1 |
private void evaluateOperator() throws BinaryOperatorException {
BinaryOperator operator = expressionStack.operatorStack.pop();
if (2 > expressionStack.operandStack.size()) {
throw new BinaryOperatorException("binary operator wasn't calculated");
}
BigDecimal operandFirst = e... | 1 |
private void closeSelectedSpecifications()
{
List<SpecificationDocument> selectedSpecifications = selectedSpecifications();
if (selectedSpecifications.isEmpty())
{
return;
}
boolean hasEditedDocuments = hasEditedDocuments(selectedSpecifications);
... | 7 |
private void setOrder(String sortField, String sortOrder, Criteria criteria) {
if (sortOrder.equalsIgnoreCase("ASC") && sortField != null) {
criteria.addOrder(Order.asc(sortField));
} else if (sortOrder.equalsIgnoreCase("DESC") && sortField != null) {
criteria.addOrder(Order.desc(sortField));
}
} | 4 |
public static void main(String args[]) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
for(int T=parseInt(in.readLine().trim()),t=0;t<T;t++){
StringTokenizer st=new StringTokenizer(in.readLine());
int N=parseInt(st.nextToken());... | 8 |
public IntegerStack copy() {
IntegerStack res=new IntegerStack(data.length);
res.count=count;
for(int i=0;i<count;i++)
res.data[i]=data[i];
// in most cases actually empty stacks are cloned in JEL
// System.arraycopy(data,0,res.data,0,count);
return res;
}; | 1 |
protected @Override Module retrieveModule(final String locator, final long version) throws StorageException {
assert (locator != null): "Supplied locator is null";
assert (version >= -1): "Invalid revision number supplied";
try {
final RandomAccessFile file = FileAccessManager.getFile(l2p(locator));
try {
... | 7 |
public Fish(Vector2f position, FishType type, int animationDelay) throws SlickException {
this.position = position;
this.type = type;
this.delay = animationDelay;
this.animation.add(new Image("res/fish/regular.png"));
this.animation.add(new Image("res/fish/regular1.png"));
this.animation.add(new Image("r... | 3 |
public void testPlus_Months() {
Months test2 = Months.months(2);
Months test3 = Months.months(3);
Months result = test2.plus(test3);
assertEquals(2, test2.getMonths());
assertEquals(3, test3.getMonths());
assertEquals(5, result.getMonths());
assertEquals(... | 1 |
public void actionPerformed(ActionEvent e) {
if (e.getSource() == buttonOk) {
wavelength = (int) Double.parseDouble(textWavelength.getText());
loadExistingValues();
updateConsole();
}
if (e.getSource() == buttonNext) {
power[i] = Double.parseDouble(textPower.getText().replaceAll(" ", "").replaceAll("... | 8 |
public void newdrain() // this makes it so when the player activates a new prayer if the new drain rate is faster it uses that one ;)
{
int OldDrain = PrayerDrain;
if(NewDrain > OldDrain && Noprayer == false)
{
PrayerDrain = OldDrain;
}
else if(NewDrain <= OldDrain || Noprayer == true)
{
PrayerDrain = NewDrain;
}
} | 4 |
public static String completexpath_class(String tableid, String search,
String linkname, int columnnumber,String controltype) throws Exception {
ArrayList object = new ArrayList();
int rows = getNoOfRowsInGrid_class(tableid);
int stringincrementer = 0;
for (int i = 1; i < rows; i++) {
String temp = conf... | 7 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Address other = (Address) obj;
if (!Objects.equals(this.street, other.street)) {
return false... | 5 |
public ArrayList<Interval> insert(ArrayList<Interval> intervals,
Interval newInterval) {
// Start typing your Java solution below
// DO NOT write main() function
ArrayList<Interval> res = new ArrayList<Interval>();
int n = intervals.size();
int i = 0;
// 第一步,找到左端点
while (i < n && intervals.get(i).end <... | 8 |
@Override
public void extract() throws XMLStreamException, FileNotFoundException
{
FileInfo terc = this.bfis.get(Parser.Types.TERC.toString());
this.factory = XMLInputFactory.newInstance();
this.readerRaw = factory.createXMLStreamReader(new BufferedInputStream(new FileInputStream(... | 5 |
public ConvertPane(Grammar grammar, Automaton automaton,
Map productionsToTransitions, Environment env) {
this.grammar = grammar;
this.automaton = automaton;
this.setLayout(new BorderLayout());
JSplitPane split = SplitPaneFactory.createSplit(env, true, .4, null,
null);
this.add(split, BorderLayout.CEN... | 0 |
private static boolean hasOptionPrefix(String arg) {
return arg.startsWith("-") || Platform.isWindows() && arg.startsWith("/"); //$NON-NLS-1$ //$NON-NLS-2$
} | 2 |
private void compileShader() {
glLinkProgram(resource.getProgram());
if (glGetProgram(resource.getProgram(), GL_LINK_STATUS) == 0) {
Util.err(fileName + ": " + glGetShaderInfoLog(resource.getProgram(), 1024));
System.exit(1);
}
glValidateProgram(resource.getProg... | 2 |
public void disconnect()
{
if(serialPort != null && serialPort.isOpened() )
{
try {
serialPort.setDTR(false);
serialPort.setRTS(false);
serialPort.removeEventListener();
serialPort.closePort();
} catch (Exception e) {
publish(Messages.SerialWorker_6);
explainSerialPortException(e);... | 3 |
public static boolean getMouseDown( int mouseButton )
{
return getMouse( mouseButton ) && !lastMouse[mouseButton];
} | 1 |
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.