method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c3c19eac-9e54-4c66-b3db-b2eed3e702d9 | 9 | private int jjMoveStringLiteralDfa4_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0);
return 4;
}
switch(curChar)
{
case 71:
... |
034aca0d-e65c-47ff-a2c1-f83f9ae1e7a7 | 8 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof NumberAxis)) {
return false;
}
if (!super.equals(obj)) {
return false;
}
NumberAxis that = (NumberAxis) obj;
i... |
7aaac14f-9b0c-4ed7-9bc5-1a7a6c67d0eb | 4 | @Test
public void testQueryTransactions() {
System.out.println("############################################################3");
System.out.println("############################################################3");
System.out.println("##########################################################... |
04a3b29a-e500-4126-b01b-ad4c31201bfd | 2 | public void actionPerformed(ActionEvent event)
{
// Variables
String name = "UNFILLED";
String expertise = "UNFILLED";
String type = "UNFILLED";
Speaker speaker = null;
// Text fields
name = textName.getText();
expertise = textExpert.getText();
type... |
d14df4fc-0495-4869-acaa-185a17faa4da | 3 | public BigBedDataBlock(SeekableStream fis, RPTreeLeafNodeItem leafHitItem,
HashMap<Integer, String> chromosomeMap, boolean isLowToHigh, int uncompressBufSize){
this.fis = fis;
this.leafHitItem = leafHitItem;
this.chromosomeMap = chromosomeMap;
this.isLowToHigh = isLowToHigh;
... |
0c6d3647-efa9-4556-807e-333c96b944e6 | 6 | public Graphics drawBox(Box tempBox ,Graphics g, boolean cursors)//draw the square for normal squares
{
int [] topLeft = tempBox.getTopLeft();
int [] topRight = tempBox.getTopRight();
int [] bottomLeft = tempBox.getBottomLeft();
int [] bottomRight = tempBox.getBottomRight();
g.setColor(Color.black);
if ... |
e5eee34e-5d7d-4039-8783-99e1c60a912f | 5 | public void write (Connection connection, ByteBuffer buffer, Object object) {
byteBufferOutputStream.setByteBuffer(buffer);
int start = buffer.position();
try {
json.writeValue(object, Object.class, null);
writer.flush();
} catch (Exception ex) {
throw new JsonException("Error writing object: " + objec... |
74c00808-994b-4cd9-bda9-0de46a3bef5b | 0 | public AngelBodyArmor() {
this.name = Constants.ANGEL_BODY_ARMOR;
this.defenseScore = 10;
this.money = 300;
this.paybackMoney = this.money /2 ;
} |
65359b20-c202-46e6-b7cc-f7ad38c0c80f | 5 | private void mouseMotionEvent(int xCoordinate, int yCoordinate){
if(this.currentSelectedBlock!=null){
if(Coordinate.isValidX(xCoordinate, Coordinate.minX, Coordinate.maxX) &&
Coordinate.isValidY(yCoordinate, Coordinate.minY, Coordinate.maxY)){
// System.out.println("Coordinate MAX: ("+Coordinate.minX+","+C... |
06c2c8e7-80a6-4070-836b-d61d46ec6968 | 2 | @Test
public void testCombatDestroyingCreatures() {
decks.add(activeCreatures);
decks.add(activeCreatures);
game.makePlayers(decks);
game.initializeGame();
// By setting the players' life to something obscenely high, I ensure
// that there will always eventually be an instance of one creature
// blocking... |
2c9beea7-008b-413c-84fa-43f98b75ed32 | 2 | public void setPWResetFontcolor(int[] fontcolor) {
if ((fontcolor == null) || (fontcolor.length != 4)) {
this.pwResetFontColor = UIFontInits.PWRESET.getColor();
} else {
this.pwResetFontColor = fontcolor;
}
somethingChanged();
} |
efca89ae-b683-425c-96b1-1b4e1c498f3d | 8 | public void wdgmsg(Widget sender, String msg, Object... args) {
int ep;
if ((ep = epoints.indexOf(sender)) != -1) {
if (msg == "drop") {
wdgmsg("drop", ep);
return;
} else if (msg == "xfer") {
return;
}
}
... |
3d212bf1-574a-42bd-93c4-79544c38d3cd | 6 | public static HashMap<String,Integer> count( String subject, String body){
HashMap<String,Integer> tokenFreq = new HashMap();
String[] stokens = subject.split("\\s");
String[] btokens = body.split("\\s");
for(String s : stokens){
if(s.length()>1){
s = "subject*" + s;
s = s.toLowerCase();
if(... |
c04e7143-8956-490c-a2b7-33edbc43e47c | 2 | public ClientHandler(String addr, int port) {
try {
client_socket = new Socket(addr, port);
os = new PrintStream(client_socket.getOutputStream());
is = new DataInputStream(client_socket.getInputStream());
inputLine = new DataInputStream(new BufferedInputStream(Sys... |
ce464fad-3816-41db-94cb-447c8885da35 | 3 | public ArrayList<String> findFiles() {
ArrayList<String> validFiles = new ArrayList<String>();
File dir = new File(database + "SpeakerFile_files/");
// array of strings for file names
String[] children = dir.list();
//if there is no files in directory
if (children == null... |
1875e4ca-f42a-4021-bf45-63e9b6b8de4f | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=(givenTarget!=null)?givenTarget:mob.location();
if(target.fetchEffect(ID())!=null)
{
mob.tell(L("Decoys have already been set here."));
return false;
}
if(mob.isInCo... |
2ddd20a3-6ec0-4598-b824-35f9add86cd3 | 2 | public static ArrayList<Move> king(Board b, int color) {
ArrayList<Move> moves = new ArrayList<Move>();
int piece = (color == Board.white) ? Board.whiteKing : Board.blackKing;
ArrayList<Position> pieces = findPieces(b, piece);
int opponentColor = Board.opponentColor(color);
for (Position p : pieces) {
// ... |
3b0c5d82-d89f-4e2b-ae23-bf17624f83ef | 0 | public KeyPackageType createKeyPackageType() {
return new KeyPackageType();
} |
7849abd8-2df9-400e-804f-45a055bb14b5 | 7 | public void endElement(String namespaceURI, String localName,
String rawName) throws SAXException {
if (rawName.equals("author") || rawName.equals("editor")) {
Person p;
if ((p = Person.searchPerson(Value)) == null) {
p = new Person(Value)... |
c39ef4a6-9fb5-453b-a26c-11d9646edcea | 4 | @Override
public void createTeam(Team team) {
checkDataSource();
validate(team);
if (team.getId() != null) {
throw new IllegalArgumentException("Team aleready exists" + team.toString());
}
try (Connection conn = dataSource.getConnection();
Prepare... |
1f659bfa-e69b-4ccc-8cc1-870acc47d640 | 6 | public void playRandomMusicIfReady()
{
if (loaded && this.options.musicVolume != 0.0F)
{
if (!sndSystem.playing("BgMusic") && !sndSystem.playing("streaming"))
{
if (this.ticksBeforeMusic > 0)
{
--this.ticksBeforeMusic;
... |
6461ffe6-11d1-4542-bc04-a355ac3b2006 | 4 | protected static Ptg calcCorrel( Ptg[] operands ) throws CalculationException
{
// get the covariance
PtgNumber pnum = (PtgNumber) calcCovar( operands );
double covar = pnum.getVal();
Ptg[] xPtg = new Ptg[1];
xPtg[0] = operands[0];
Ptg[] yPtg = new Ptg[1];
yPtg[0] = operands[1];
pnum = (PtgNumber) calc... |
755f886c-604f-47ff-9d78-3de9a7e46b1d | 4 | public boolean isHuwelijkOp(Calendar datum) {
//todo opgave 1
if (this.huwelijksdatum == null)
return false;
else if (datum == null)
return false;
else if (this.huwelijksdatum == datum)
return true;
else if (this.huwelijksdatum.before(datum))
... |
fef1185e-aaaa-40f6-8165-efb0cc49b32f | 7 | private boolean reachableRejectBridge(Transition t) {
return (t.source.production != null && t.source.production.reachable && t.target.production != null && t.target.production.reject) ||
(t.target.production != null && t.target.production.reachable && t.source.production != null && t.source.production.reject);... |
bc38acff-e5d6-46a1-ac94-ae9ebeec4f0e | 9 | @Override
public String toString(){
PolyNode current = firstNode;
String str = "";
if(isEmpty())
return "The polynomial is empty!";
while(current != null){
if(current == firstNode)
str += current.getCoefficient();... |
f1b64a30-328b-49cc-8246-80702a824909 | 5 | public void travelTo(int zoneId, int districtNumber) throws IOException {
long start = System.currentTimeMillis();
this.initMapLoad();
this.zoneMap(zoneId, districtNumber);
int status = -1;
boolean secondStatusCheck = false;
do {
try {
Thread... |
3b35dea6-c393-4939-ad3e-8f9332b26163 | 7 | public void scoreGoal(Player p){
//might need to add stuff to Player.scoreGoal() so that this works correctly
if(p == null)
return;
float x = p.getXLeft();
float y = p.getYTop();
if(getTeamWithBall() == team1){
float x2 = team2.getPlayers().get(0).getXLeft();
float y2 = team2.getPlayers().get(0).ge... |
734dba49-6f86-49e7-9ee7-b0b7f3ff23f0 | 4 | public void hit(ArrayList<Tank> tanks){
for(Tank tank:tanks){
if(tank.inside(this) && tank.getId()!=id && tank.isAlive() ){
this.setAlive(false);
}
}
} |
332cd14b-233f-41ed-a7b6-ef34e50b1651 | 3 | public static void sort(int[] array) {
printArray(array);
int tmp, index;
for (int i = 0; i < array.length - 1; i++) {
tmp = array[i + 1];
for (index = i; index >= 0; index--) {
if(array[index] > tmp) {
array[index + 1] = array[index];
} else {
break;
... |
58b59242-6a24-4b93-b9f6-1e7345362d2b | 8 | private void go() {
if (offenseArmy.isEmpty() || defenseArmy.isEmpty()) {
throw new IllegalStateException("shouldnt be doing this with empty armies..");
}
BattleStats attackStats = new BattleStats();
BattleStats defenseStats = new BattleStats();
for (Warrior w : offenseArmy) {attackStats.computeFriendly(w)... |
f9cea1d3-7eb3-4b01-b999-a721d0dc3368 | 3 | static void testAllH()
{
Scanner in = new Scanner(System.in);
final Board b = Board.readBoard(in);
ArrayList<Integer> nextPiece = new ArrayList<Integer>();
while(in.hasNextInt())
nextPiece.add(in.nextInt());
Heuristic hAll [] =
{
//new BoardScore(),
//new BoardScoreNormalised(),
//new Em... |
7143e94a-d083-4e8e-a7f9-72d4d34bf1cf | 7 | static public void main( String args[] ) throws Exception {
if (args.length!=1) {
System.err.println( "Usage: java UseScatterGather port" );
System.exit( 1 );
}
int port = Integer.parseInt( args[0] );
ServerSocketChannel ssc = ServerSocketChannel.open();
InetSocketAddress address = new... |
afeee56c-b8d1-4350-a43e-83ba8b630b3f | 3 | int hamming(Genotipo a, Genotipo b)
{
if(a.getSize()!=b.getSize()) {
System.err.println("Los genotipos deben ser de igual longitud");
System.exit(1);
}
int ret = 0;
int tam = a.getSize();
for(int i=0; i<tam; i++) {
if(a.getGen(... |
7f51976f-79b6-4ab7-972a-7f51fd80060c | 1 | int rmUsr(String id, String userName) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection(url, dbUser, dbPass);
Statement stm = con.createStatement();
... |
5c6ac846-f68c-4f05-9b03-064b116b707c | 4 | @Override
public void actionPerformed(ActionEvent e) {
if( e.getSource() == boton_alta_venta){
Controlador.getInstance().accion(EventoNegocio.GUI_ALTA_VENTA, GUIPrincipal_Venta.this);
}
else if( e.getSource() == boton_devolver_producto){
... |
7a62cd30-33c2-4adb-ba4e-96da291cec23 | 3 | @Override
public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark {
//Find the row.
int boardPositionRow = boardPosition / columns;
//Find the column.
int boardPositionColumn = boardPosition % columns;
... |
e6ad9a3f-96b3-4dec-b7cc-9dc245f246e2 | 9 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s;
ArrayList<Double> l2 = new ArrayList();
ArrayList<Double> l3 = new ArrayList();
ArrayList<Integer> lf = new ArrayList();
for (in... |
c8097f81-5181-494c-8f6d-5a1d7f9d4287 | 3 | public boolean hasHIV(String player) {
String query = "SELECT * FROM nosecandy WHERE hiv='1';";
ResultSet result = null;
result = this.sqlite.query(query);
boolean hiv = false;
try {
if (result != null && result.next()) {
hiv = result.getBoolean(Column.HIV.getName());
}
result.close();
} catch ... |
5a9b30c8-e179-4dc4-9a30-a84c33a868e5 | 9 | public void readData(boolean binaryFeatures) {
try {
File imgFile = new File("digitdata"+File.separator+"trainingimages");
BufferedReader imgInput = new BufferedReader(new FileReader(imgFile));
File labelFile = new File("digitdata"+File.separator+"traininglabels");
BufferedReader labelInput = new Buffered... |
28e9fd5d-4aba-43aa-96a8-a392dc801991 | 7 | public static void main(String[] args)
{
//First, let's check the OS and set the Look and Feel based on that
OsCheck.OSType ostype = OsCheck.getOperatingSystemType();
switch(ostype)
{
case Windows:
try
{
sys... |
e0614d67-c88b-436c-86ef-7dfff4af3a11 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SpecificationSubModel other = (SpecificationSubModel) obj;
if (featureSpecSet == null) {
if (other.featureSpecSet != null)
return false;
... |
0a086f00-0a13-403a-8c09-52c638d011b1 | 6 | public void init() {
if (tower == null && towerId != 0) {
tower = towerService.findTower(towerId);
} else if (tower == null && towerId == 0) {
tower = new Tower();
}
if (tower == null) {
try {
FacesContext.getCurrentInstance().getExtern... |
b8cd5533-c199-4340-a861-45e46f5b22f8 | 1 | public World(List<Entity> entities, List<Tile> map, List<PickUpObject> pickUps, Player player){
this.map = map;
this.entities = entities;
this.pickups = pickUps;
this.player = player;
everything = new ArrayList<>();
everything.addAll(map);
everything.addAll(entities);
everything.addAll(pickUps);
for(... |
28022a1c-20b0-4c87-9e29-b7c8bb137195 | 3 | @Override
public void run() {
Website2EbookmakerApplication app = ((Website2EbookmakerApplication)StartModalWindow.this.getApplication());
app.getWebScraper().setRoot(url);
app.getWebScraper().scrape();
if (!url.startsWith("http://")) {
url = "http://... |
b7236cae-6781-40e6-aa8a-823f71ebf06e | 3 | public JSONArray toJSONArray(JSONArray names) throws JSONException {
if (names == null || names.length() == 0) {
return null;
}
JSONArray ja = new JSONArray();
for (int i = 0; i < names.length(); i += 1) {
ja.put(this.opt(names.getString(i)));
}
re... |
80c51447-668f-4b11-b333-529e30f033ce | 3 | public void actionPerformed(ActionEvent e) {
Grammar g = environment.getGrammar(UnrestrictedGrammar.class);
myGrammar=g;
if (g == null)
return;
if (g.getTerminals().length==0)
{
JOptionPane.showMessageDialog(environment,
"Error : This grammar does not accept any Strings. ",
"Cannot Proceed wit... |
3ab15709-820b-4d2e-ba7f-aec92b0716ad | 8 | public boolean moveOrganism(int orgID, int directionCode){
boolean moved = false;
// North or south
if(directionCode == 1 || directionCode == 2){
int y = org.getY(orgID);
if (directionCode == 1){ // North
moved = moveLogic(orgID, org.getX(orgID), y-1, f... |
282ffa93-8b10-46d6-a50b-b3fea3a23f64 | 5 | public Token expr() throws OperazioneNonValidaException, ParentesiParsingException
{
Token x = molDivMod();
if(!(point>text.size()-1))
{ while(peek().ritornaTipoToken().equals(Tok.PIU)||peek().ritornaTipoToken().equals(Tok.MENO))
{
Token op = peek();
consume();
Token y = molDivMod();
int n1 = ... |
9016e9e5-2930-4389-ad66-64b88e228f2b | 5 | protected static Ptg calcPPMT( Ptg[] operands )
{
if( operands.length < 4 )
{
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "calcPPMT" );
double rate = operands[0].getDoubleVal();
int per = operands[1].getIntVal();
int nper = operands[2].getIntVal();
double pv = operands[3].get... |
cca65946-023a-4fda-9cb0-d30f21e29d59 | 2 | public void connectPuls(){
// try {
// DefaultHttpClient client = new DefaultHttpClient();
// HttpPost post = new HttpPost("https://puls.uni-potsdam.de/qisserver/rds?state=user&type=1&asdf=jbernoth&fdsa=bl4bl411&category=auth.login&startpage=portal.vm");
// HttpResponse res = client.execute(post);
// System.ou... |
a9926cb8-4ebb-4642-9c5a-837a72fd47b2 | 3 | public static TriCubicSpline zero(int nP, int mP, int lP){
if(nP<3 || mP<3 || lP<3)throw new IllegalArgumentException("A minimum of three x three x three data points is needed");
TriCubicSpline aa = new TriCubicSpline(nP, mP, lP);
return aa;
} |
e4a9346e-2f8d-4e9f-a461-3af47c728697 | 1 | private int getTotalHeuresAccumulees() {
Set<String> listeCategories = heuresAccumulees.keySet();
Iterator it = listeCategories.iterator();
int heures = 0;
while (it.hasNext()) {
String categorie = (String)it.next();
heures += heuresAccumulees.get(categorie);
... |
ed6ee956-866a-4247-a586-4ac6d365ce23 | 7 | public void loadFile(String path) throws IOException {
String thisLine; // variable to read each line.
BufferedReader myInput = null;
try {
FileInputStream fin = new FileInputStream(new File(path));
myInput = new BufferedReader(new InputStreamReader(fin));
// for each line until the end of the file
wh... |
b52707b7-b636-43da-8873-e531883b2eed | 8 | public void playersTurns(Board board, Player player1, Player player2) throws IOException{
char response;
boolean match = false;
int totalMatchesMade = 0;
numCards = board.totalCards;
String name;
int counter = 1;
while (totalMatchesMade < board.totalMatc... |
dca4d7e5-7cb8-4b63-9f31-d73023c1ec32 | 9 | @SuppressWarnings("unchecked")
// use runtime checks to guarantee that 'T' is what it is
private <T> ObjectConstructor<T> newDefaultImplementationConstructor(Type type, Class<? super T> rawType) {
if (Collection.class.isAssignableFrom(rawType)) {
if (SortedSet.class.isAssignableFrom(rawType)) {
return new Ob... |
38664702-7c61-4bc4-ac33-d3aaa4bab653 | 2 | public static ClientType clientTypeOf(String role) {
if (role == null) {
return ClientType.GUEST;
}
try {
return ClientType.valueOf(role);
} catch (IllegalArgumentException ex) {
return ClientType.GUEST;
}
} |
04acbd6d-2194-4515-96e3-1bb771fdc371 | 9 | public void step(boolean blockStep) {
Configuration[] configs = configurations.getValidConfigurations();
ArrayList list = new ArrayList();
HashSet reject = new HashSet();
// Clear out old states.
configurations.clearThawed();
if (!blockStep){ //for ordinary automaton
for (int i = 0; i < ... |
efb8c30e-df1b-4275-a057-51bd73fdb462 | 4 | public int getX() {
boolean test = false;
if (test || m_test) {
System.out.println("Coordinate :: getX() BEGIN");
}
if (test || m_test) {
System.out.println("Coordinate :: getX() END");
}
return m_X;
} |
f6efaa9e-ea04-4ca8-b0a5-89f425f11518 | 6 | public static void loadFiles(String path)
{
File folder = new File(path);
File[] listOfFiles = folder.listFiles(); //load all files in folder
if (listOfFiles != null && listOfFiles.length > 0)
{
for(File file:listOfFiles)
{
//if (file.isFile()) //is file? (not folder)
//{
String filename ... |
f9ead357-118c-4563-b463-0dc710629da9 | 3 | private void drawHeadIcon() {
if (anInt855 != 2) {
return;
}
getEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2, (anInt935 - baseY << 7) + anInt938);
if (spriteDrawX > -1 && Client.loopCycle % 20 < 10) {
hintIcon[0].drawSprite(spriteDrawX - 12, sp... |
611dda96-9f72-45bd-becc-2dc40edf8a41 | 5 | @Override
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
if (par1World.isRemote) {
return;
}
// 既に光っていればなにもしない
if (isLighting) {
return;
}
// エンティティが矢であり、かつ刺さった状態であれば
if ((par5Entity != null) && (par5Entity instanceof EntityArrow)) {
/... |
52cc8c30-2cba-4f82-9f0c-429d7ffe3dca | 4 | public static void main(String[] args) {
try {
bundle = ResourceBundle.getBundle("net/sourceforge/jfilecrypt/translations/jfilecrypt", Locale.getDefault());
} catch(MissingResourceException resEx) {
bundle = ResourceBundle.getBundle("net/sourceforge/jfilecrypt/translations/jfilec... |
4720034a-97c6-4661-bfea-b22ab0523232 | 5 | static <FieldDescriptorType extends
FieldSet.FieldDescriptorLite<FieldDescriptorType>>
SmallSortedMap<FieldDescriptorType, Object> newFieldMap(int arraySize) {
return new SmallSortedMap<FieldDescriptorType, Object>(arraySize) {
@Override
@SuppressWarnings("unchecked")
public void makeI... |
b65cfebd-24c5-4ce7-a099-fb5b890531f4 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
0abbc7ce-8de7-4192-b901-1ec8842ec2ff | 2 | public static InferenceWorkerSuspendReason fromCycSymbol(final CycSymbol symbol) {
final InferenceWorkerSuspendReason reason = SYMBOL_MAP.get(symbol);
if (reason != null) {
return reason;
} else if (symbol == null) {
return UNKNOWN;
} else {
throw new IllegalArgumentException("Unable t... |
a8c2579c-a968-4ebd-9f59-268c4a70f254 | 8 | public Enduro(String[] args) {
String cfg = "config.properties";
if(args.length == 1){
cfg = args[0];
}
if (args.length == 0 || args.length == 1) {
Properties configFile = new Properties();
genCon = new GenerateConfig(configFile);
try {
configFile.load(new FileInputStream(cfg));
if(genCon.ch... |
709bf2b3-cad3-4ffd-b8bb-6ee13b7344ef | 8 | public boolean initialiseWithLines(ArrayList<StringBuffer> lines, ProcessingOptions options) throws UnsupportedEncodingException {
//remove blank rows at the bottom
boolean done = false;
int i;
for(i = lines.size() - 1; !done; i--){
StringBuffer row = lines.get(i);
if(!StringUtils.isBlank(row.toString())... |
9a8a5de5-2dd7-4e85-b88c-dcfa24028664 | 6 | public static Object conv(Object inpValue, Class<?> fieldType) {
Class inpType = inpValue.getClass();
if (inpType == String.class && fieldType != String.class) {
inpValue = Conversions.convert((String) inpValue, fieldType);
} else if (inpType == BigDecimal.class && fieldType != BigDe... |
b6fdca8e-a596-4bd9-b756-7050d1b626f2 | 7 | protected static String numberToString(Number number)
{
if (number == null) {
return "null";
}
if (!testValidity(number)) {
throw new RuntimeException("Can't convert number: " + number);
}
// Shave off trailing zeros and decimal point, if possible.
String string = n... |
49ab7564-d4bc-47e4-b316-5f66488a3c13 | 7 | public static void startupSessions() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/HTTP", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Modu... |
edf65670-d24b-4453-9bfc-7c861f032bc9 | 2 | public static void printMap(Map map,String prefix){
for(Map.Entry entry : (Set<Map.Entry>)map.entrySet()){
if(entry.getValue() instanceof Map){
System.out.println(prefix+"map:"+entry.getKey());
printMap((Map)entry.getValue(),prefix+"--");
}else{
... |
5e46e377-eca1-4c7b-8506-78996189affe | 9 | public boolean enviarMail(String email, String passw, boolean envio) throws MessagingException {
boolean ret = false;
abrirBase();
LazyList<Email> emailsModel = Email.findAll();
if (!emailsModel.isEmpty() || !envio) {
if (envio) {
abrirBase();
... |
9569a165-5750-4bae-9505-3e419f7eb924 | 0 | protected int getMaxAge()
{
return MAX_AGE;
} |
431e030a-eecb-4686-83ea-b904ef384d59 | 8 | public int getNewPoints(){
int returnValue = 0;
if(plusminus > 13) returnValue = 9;
else if(plusminus > 9 ) returnValue = 7;
else if(plusminus > 5) returnValue = 5;
else if(plusminus > 2) returnValue = 3;
else if(plusminus > -3) returnValue = returnValue;
else if(... |
7530ddef-5e7a-4913-aba1-cf95f801faaa | 9 | public void checkbox(boolean rdbtn_lavagem, boolean rdbtn_otimizacao, boolean rdbtn_produto) throws TiposSelecionadosException{
TiposSelecionadosException e = new TiposSelecionadosException();
if(rdbtn_lavagem && rdbtn_otimizacao){
throw e;
}else if(rdbtn_lavagem && rdbtn_produto){
throw e;
}else if(rdbtn... |
afc1adf6-9252-41b0-99f9-620d458ced17 | 2 | public static CauseTypeEnum fromValue(String v) {
for (CauseTypeEnum c: CauseTypeEnum.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
426010e3-6463-44fe-bb39-bde8e36dbfa5 | 9 | public void amplifyPix(ImageFrame if1, Point p, int intensity) {
int pixArr[] = new int[4];
if1.getBum().getData().getPixel(p.x, p.y, pixArr);
Color col = new Color(pixArr[0], pixArr[1], pixArr[2]);
for(int i=0; i<intensity; i++) {
try {
if1.getBum().setRGB(p.x+i, p.y, col.getRGB());
} catch(ArrayInde... |
598be518-8e0e-4008-904d-d5ec011495a4 | 3 | public void restoreBackup(String backupSourcePath) throws SQLException {
String backupTempDirectory = Controller.getProperty(ApplicationProperties.APPLICATION_PATH);
try {
ZipFile zipFile = new ZipFile(backupSourcePath);
zipFile.extractAll(backupTempDirectory);
backupTempDirectory += File.separator + (n... |
130eadac-8c3c-49b2-b7d5-9c7f5586b6c6 | 5 | public static void addAbility(Unit owner, Ability ability) {
if (owner != null && ability != null) {
// check if ability already has an owner -> if so then remove the ability from the current unit
if (ability.getOwner() != null)
GameLogic.INSTANCE.removeAbility(ability.getOwner(), ability);
// add abili... |
4fe69b67-7cec-4361-8c65-1ae40c373ec7 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EVDistribution other = (EVDistribution) obj;
if (def != other.def)
return false;
if (hp != other.hp)
return false;
if (nature == null) ... |
23d24e72-21ef-4592-b359-d59add87b18e | 0 | public String toString() {
return "[" + getCurrentState().toString() + "]";
} |
701a7d14-4e1f-4196-8f3f-4283ff9b9ca6 | 2 | @Override
public String toString() {
String result = "Subject: " + this.getSubject() +
" Description: " + this.getDescription() +
" AuthorID: " + this.getAuthor() +
" CommentIDs: ";
for (Integer comment : this.getComments()) {
result += com... |
72ce7044-c303-47dd-aa48-9c60a223fe2b | 0 | LRParseTableChooserPane getParseTableView() {
return tableView;
} |
794b724a-5106-4474-9855-2762bede1d96 | 0 | public static void main(String args[]) {
AboutBox box = new AboutBox();
box.displayBox();
} |
1726df67-bf76-44a4-96fe-afd33c3936c6 | 3 | public Map<String, Integer> getTerms(SQLconnection sqLconnection,int paperID) {
String query = "select term from terminvertedindex where paperID="+ paperID;
ResultSet terms=sqLconnection.Query(query);
Map<String, Integer> termcountMap=new HashMap<>();
try {
while(terms.next())
{
String term=terms.getS... |
bd8e5119-9eb9-48cd-b52d-946238bcbb4e | 9 | public void setNbOfMinesTouched(int nbOfMines) {
this.nbOfMinesTouched = nbOfMines;
switch (nbOfMinesTouched) {
case 0:
type = CellType.EMPTY;
break;
case 1:
type = CellType.ONE;
break;
case 2:
type = CellType.TWO;
break;
case 3:
type = CellType.THREE;
break;
case 4:
type = Cell... |
3ce50111-1c0b-4bac-bb4b-5af60bcd8d9d | 0 | @Override
public void start() throws Exception {
logger.info(getName() + " start execute.");
remoteServerCall.start();
logger.info(getName() + " start success.");
} |
7628c571-58f5-4f78-a58c-1ca7c051246d | 4 | public String toString()
{
if (type == null)
return super.toString();
else if (type.equals("flex.messaging.io.ArrayCollection"))
{
StringBuilder sb = new StringBuilder();
Object[] data = (Object[])get("array");
sb.append("ArrayCollection:[");
for (int i = 0; i < data.length; i++)
{
sb.appen... |
fa3a96da-4252-4865-a446-fc97619fb79d | 1 | public void sendMessage(ChannelMessage message) {
for (Player player : players) {
player.sendMessage(message);
}
} |
3f98de1b-26ac-4f43-8977-f8c418916a77 | 6 | public boolean hasFlag(int flags, int flag) {
System.out.println("Total flags: " + Integer.toBinaryString(flags) + " " + Integer.toBinaryString(flag) + " " + flag);
boolean hasFlag = false;
boolean finished = false;
int waarde = 2048;
int newFlag = flags;
while (!finished... |
6077ad7c-ed8f-4b5c-a448-4d22cb37b170 | 5 | public void makeSHButtonActionPerformed(ActionEvent evt)
{
String name = "Stakeholder " + (this.stakeholders.size());
boolean a,b,c,d,e;
a=b=c=d=e=false;
int random = (int) (Math.random()*32);
System.out.println(random);
if(random >= 16){a = true;random -= 16;}
... |
46df83dc-ec1c-4248-8b13-196362e2330d | 8 | public void updatePosition() {
if (xPos < xDestination)
xPos++;
else if (xPos > xDestination)
xPos--;
if (yPos < yDestination)
yPos++;
else if (yPos > yDestination)
... |
4231d6b0-84b4-4118-9d9c-59b76c5f15f8 | 3 | public boolean initialize( URL url )
{
initialized( SET, false );
cleanup();
if( url == null )
{
errorMessage( "url null in method 'initialize'" );
cleanup();
return false;
}
try
{
myAudioInputStream = ... |
b9bc9316-13de-47fe-a6a7-98e85a6a77b4 | 0 | public static void main(String[] args) {
new Main().execute(args);
} |
6e4d797b-493c-4c90-b650-62c7cb61ff06 | 8 | public Query newQuery(String script0, Object ...args) throws ParseException {
HashMap<String,Integer> vars = new HashMap<>();
String script = "";
for (int i = 0; i < script0.length(); ) {
int j = script0.indexOf('%', i);
if (j == -1) {
script += script0.substring(i);
break;
}
script += script0... |
ad3030fc-6d7e-4f8b-a299-8e58801d9f3a | 9 | @Override
public void paint( Graphics g ) {
int screenWidth = getWidth();
int screenHeight = getHeight();
int screenCenterX = screenWidth/2;
int screenCenterY = screenHeight/2;
g.setColor( Color.BLACK );
g.fillRect( 0, 0, screenWidth, screenHeight );
for( BackgroundArea area : vws.visibleBackground... |
61bc0503-701b-4d62-aca1-b01b7535390e | 1 | private int[] mergeSort(int[] a) {
if(a.length == 1) return a;
int leftLen = a.length / 2;
int rightLen = a.length - leftLen;
int[] left = new int[leftLen];
int[] right = new int[rightLen];
System.arraycopy(a, 0, left, 0, leftLen);
System.arraycopy(a, leftLen, r... |
c1cd4bad-7b84-43f3-8a75-5b9bf2b40451 | 1 | private boolean openWorkspace(File openFile){
WorkspaceData openData;
try{
FileInputStream inputStream = new FileInputStream(openFile);
ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
openData = (WorkspaceData) objectInputStream.readObject()... |
a96c2d2d-e58a-4613-a9a8-1e97be329375 | 3 | private static void cutInputValidator() {
while (!validInput) {
try {
System.out.print("You selected to search by cut. Please enter a cut: ");
cutInput = actionInput.next();
cutInput.toUpperCase();
System.out.println("You entered: " + cutInput);
validInput = true;
if(data1.isEmpty()) {
... |
8bae7527-cd33-42c3-9011-0ce1d4ad9434 | 5 | @Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld suppresshealthregain <worldname> <true|false>");
} else if (!hasWorld(worldName)) {
reply("World not found: " + wor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.