method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e291f306-c3e5-49e7-a1a0-18ecc50d27a6 | 4 | private void afficherMatchs() throws IOException, SQLException {
lbNumJour.setText(Integer.toString(jour)+"/01");
if (jour == 22) btPrec.setEnabled(false);
else if (jour == 30) btSuiv.setEnabled(false);
else {
btPrec.setEnabled(true);
btSuiv.setEnabled(true);
... |
56c1162f-e2ec-4670-9e59-627c7c4c3ffb | 8 | public void newArray(final Type type) {
int typ;
switch (type.getSort()) {
case Type.BOOLEAN:
typ = Opcodes.T_BOOLEAN;
break;
case Type.CHAR:
typ = Opcodes.T_CHAR;
break;
case Type.BYTE:
typ = Opcodes.T_BYTE;
break;
case Type.SHORT:
typ = Opcodes.T_SHORT;
break;
case Type.INT:
t... |
b00865b3-81d9-4ac5-9a9c-16ba9901fa8e | 8 | public ComparativeTableControl.DataSource getComparativeDataSource()
{
return new ComparativeTableControl.DataSource()
{
public int getRowCount()
{
int rowCount = 0;
for (int dsftBinIndex = 0; dsftBinIndex < dsftBinSpriteSetLis... |
d1aabac7-4423-4cad-a448-dbbab5bdf546 | 6 | public void mouseDragged(MouseEvent e) {
if (buttonSelected == null || buttonSelected == ButtonSelected.DRAW_TRIANGLE)
return;
if (buttonSelected == ButtonSelected.SELECT) {
if (handlesSelected) { // resizing shape
createOrUpdateShape(e, Action.UPDATE_SELECTED, anchor);
handleManager.createOutline(sha... |
1498c2c1-f317-4e08-802d-6a8734219992 | 6 | public static boolean fixedTimeEqual(String lhs, String rhs) {
boolean equal = (lhs.length() == rhs.length() ? true : false);
// If not equal, work on a single operand to have same length.
if(!equal) {
rhs = lhs;
}
int len = lhs.length();
for(int i=0;i<len;i++) {
if(lhs.charAt(i) == rhs.charAt(i... |
64b2d911-66d1-470c-825f-b498826ab958 | 5 | public int canCompleteCircuit(int[] gas, int[] cost) {
int[] r = new int[gas.length];
int idx = 0, s = 0, b = -1, ts = 0;
for(int i = 0; i<gas.length; i++)
r[i] = gas[i] - cost[i];
for(idx = 0; idx < r.length; idx++){
ts += r[idx];
s += r[idx];
if(s<0){
b = -1;
... |
c385c94c-d3c9-4f56-9ae5-a015a5308aa5 | 6 | @Override
public void keyPressed(KeyEvent e)
{
int delta_x = 0;
int delta_y = 0;
switch (e.getKeyCode())
{
case KeyEvent.VK_LEFT:
delta_x = -OFFSET;
break;
case KeyEvent.VK_RIGHT:
delta_x = OFFSET;
break;
case KeyEvent.VK_UP:
delta_y = -OFFSET;
break;
case KeyEvent.VK_DOWN:
delta... |
c387dfad-44ff-4a94-9be2-7463f07ed953 | 1 | @Override
public Converter put(String key, Converter value) {
Converter v = super.put(key, value);
if (v != null) {
throw new IllegalArgumentException("Duplicate Converter for "
+ key);
}
return v;
} |
48179c15-52ad-4e3f-96ea-5dad8f1081e7 | 9 | final public boolean handshakeResponse(ByteBuffer downloadBuffer) throws WebSocketException {
ByteBuffer buffer = null;
try{
if (state == State.INIT || state == State.DONE) {
transitionTo(State.METHOD);
responseStatus = -1;
httpResponseHeaderParser = new HttpResponseHeaderParser();
bufferManager.... |
2b889dae-54ca-4d63-a2e7-b5852844e409 | 3 | public void removeProfessor(String matricula)
throws ProfessorInexistenteException {
boolean teste = false;
for (Professor e : professores) {
if (e.getMatricula().equals(matricula)) {
professores.remove(e);
teste = true;
break;
}
}
if (teste == false) {
throw new ProfessorInexistenteExce... |
30b75f66-433b-46a7-bd58-9eab85a1d74f | 2 | public Object get(String key) throws JSONException {
if (key == null) {
throw new JSONException("Null key.");
}
Object object = this.opt(key);
if (object == null) {
throw new JSONException("JSONObject[" + quote(key) +
"] not found.");
}... |
7749eaf1-4ab2-44d7-a2ad-f214e06b813c | 9 | public static void main(String[] args){
//int[] arr = {4, 3, 5, 1, 2, 6, 9, 2, 10, 11};
int[] arr = {4, 33, 5, 33, 2, 6, 9, 2, 10, 11,45};
int min;
int max;
int i = 0;
int totalElements = arr.length;
//no items in array, show a message
if(totalElements ==... |
1a3c19e3-90de-4c71-9c08-4b3e6f979e55 | 3 | public ImageCreatorDialog(final Panel panel) {
setTitle("Create square image");
setBounds(1, 1, 250, 130);
Toolkit toolkit = getToolkit();
Dimension size = toolkit.getScreenSize();
setLocation(size.width / 3 - getWidth() / 3, size.height / 3
- getHeight() / 3);
this.setResizable(false);
setLayout(null... |
ca92efae-cb1e-4edc-aed3-602d0fb1e875 | 6 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
id = buf.readInt();
if (id < 0)
throw new RuntimeException("Forbidden value on id = " + id + ", it doesn't respect the following condition : id < 0");
lifePoints = buf.readInt();
if (lifePoint... |
dbc29f78-f5e8-4603-904c-2ec4e82365e9 | 6 | @Override
public String toString() {
String rtn = "size = " + size + "\nUndealt cards: \n";
for (int k = size - 1; k >= 0; k--) {
rtn = rtn + cards.get(k);
if (k != 0) {
rtn = rtn + ", ";
}
if ((size - k) % 2 == 0) {
// Insert carriage returns so entire deck is visible on console.
rtn = rt... |
3cfa9bea-0f17-4f16-8c2c-9e2da8df90c5 | 4 | private void openConnection() {
if (this.dbConnParamUrl == null)
return;
try {
if (this.dbconn != null && !this.dbconn.isClosed())
this.dbconn.close();
this.dbconn = DriverManager.getConnection( dbConnParamUrl,
... |
8c416ea8-0975-492d-a72e-e794e3c29ac7 | 7 | static final void method3260(int i) {
for (Class348_Sub15 class348_sub15
= (Class348_Sub15) Class27.aClass356_389.method3484(0);
class348_sub15 != null;
class348_sub15
= (Class348_Sub15) Class27.aClass356_389.method3482(0)) {
if (((Class348_Sub15) class348_sub15).aClass55_Sub1_6768
.method... |
298cbf9c-0328-4d9e-8b39-020e2303fd44 | 8 | public static void main(String[] args) throws InstantiationException, IllegalAccessException {
int boardSize = 10;
int timeout = 20000;
for (String arg : args) {
System.err.println(arg);
}
PrintStream origOut = System.out;
System.setOut(System.err);
Sy... |
ea9a7880-a75d-4a14-9360-b8421f24f26b | 9 | protected void switchChannel(String toReplace, String replacing) {
if (toReplace.equals(replacing.toLowerCase())) { //Nothing to edit, reload the initial picture
this.changePicture(this.getRelURL());
this.revalidateContainer();
reloadChanges();
return;
}
// BufferedImage toEdit = getBufferedImag... |
21542663-0fa9-4e39-9913-058af6ef244f | 2 | public void testWithFieldAdded8() {
Partial test = createHourMinPartial(0, 0, ISO_UTC);
try {
test.withFieldAdded(DurationFieldType.minutes(), -1);
fail();
} catch (IllegalArgumentException ex) {
// expected
}
check(test, 0, 0);
... |
dec11a34-fd07-41bf-8cac-b7fe1f65d93d | 0 | public InternalRewrite(Map<String, String> headers, String uri) {
super(null);
this.headers = headers;
this.uri = uri;
} |
ef811abf-74f4-4736-bb4f-51002b815e2d | 0 | public static CircleEquation newInstance(float a, float b, float r) {
return new CircleEquation(a, b, r);
} |
da98c315-abd5-4839-874c-23e540144d53 | 8 | public int insertObject(Object obj) {
String table = this.getTableName(this.getObjectClass(obj).toString());
String fieldName[] = this.getField(obj);
String sql = "INSERT INTO "+PREFIX+table+"(";
for (int i = 0; i < fieldName.length; i++) {
sql += fieldName[i];
if(i != fieldName.length -1)
sql += ",... |
a55c0939-1668-4440-9ff1-4938394df269 | 3 | public static void main(String[] args) throws Exception {
if (args.length < 2) {
System.out.println("Usage: java JGrep file regex");
System.exit(0);
}
Pattern p = Pattern.compile(args[1]);
// Iterate through the lines of the input file:
int index = 0;
Matcher m = p.matcher("");
for (String line : ne... |
1b0e1e78-5a1d-49be-958e-950120628256 | 1 | private static String getExpressionWithToken(ParsedExpression parsedExpression, String token) {
String originalExpression = parsedExpression.getOriginalExpression();
StringBuilder actualExpression = new StringBuilder();
List<String> paramNames = parsedExpression.getParameterNames();
int lastIndex = 0;
for (in... |
4565f9fa-701e-4908-9ed8-97b0525846fe | 3 | public TrialGroup(List<Trial> trials, boolean lowLoad) throws IncorrectNumberOfTrialsException {
super(trials);
if (trials.size() != Options.TRIALS_PER_GROUP) {
//should not occur
throw new IncorrectNumberOfTrialsException("Trying to create a group of " + Options.TRIALS_PER_GROUP + " trials, but only "
... |
207abfa5-a6ba-498b-978e-9d444f8eea5f | 1 | public static final List<String> getItemUrls(
ResponseWrapper responseWrapper, Logger logger) {
List<String> urlStrings = new ArrayList<String>();
Element doc = responseWrapper.getDoc();
Elements itemElements = doc.select("dl.item");
for (Element itemElement : itemElements) {
Element aElement = itemElemen... |
2cf18c7d-a7c2-42ca-86c6-1602c380087e | 8 | public static void globalBypass(String arg){
arg = arg.toLowerCase();
if(TOGGLES.containsKey(arg)){
if(!checkPermission("eCore.invBypass.global.toggle", true))
return;
switch(TOGGLES.get(arg)){
case 0:
GlobalDataManager.invBypass = !GlobalDataManager.invBypass;
break;
case 1:
Glo... |
56a809d7-4845-4920-a4f9-9c57cc39b36a | 8 | final public void Print_statement() throws ParseException {
/*@bgen(jjtree) Print_statement */
SimpleNode jjtn000 = new SimpleNode(JJTPRINT_STATEMENT);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(PRINT);
... |
77d56027-f915-4da9-8c25-65a59e94589a | 6 | public boolean parsePatch(File f, String patch) {
String s = null;
boolean result = false;
if(patch.equalsIgnoreCase(CARRIER_PATCH)) {
s = findReturn(f, "this.carrierText = \"");
if(s!=null) {
carrierString = s.substring(s.indexOf("\"")+1, s.lastIndexOf("\... |
edddced3-0dd0-476b-bcff-070440781d81 | 1 | public String getStatus() {
if (active) {
return "Active";
} else {
return "Paused";
}
} |
900d2f3c-f095-4e1a-aee7-6f46352d65c1 | 8 | @Override
public List<Gruppi> getGruppiByUtente(Utente utente) {
List<Gruppi> result = new ArrayList();
ResultSet rs = null;
ResultSet rs1 = null;
try {
gIdGruppi_Utente.setInt(1, utente.getKey());
rs = gIdGruppi_Utente.executeQuery();
while (rs... |
464fbac2-abd7-4cdf-8322-d7164a50e831 | 1 | @Override
public String handle(String cmd) {
if (cmd.equals("clear")) {
setText("");
} else {
return "unknown command '" + cmd + "'\n";
}
return null;
} |
380daa1c-b384-47ad-9636-905a37e1c0cc | 2 | String paramList(String title, CSProperties p) {
if (p.size() == 0) {
return "";
}
List<String> keys = new ArrayList<String>(p.keySet());
Collections.sort(keys);
StringBuffer db = new StringBuffer();
db.append("<variablelist>");
... |
7987db6c-1fdf-4c9c-936b-67803d47424f | 3 | public boolean method537() {
if (anIntArray658 == null) {
return true;
}
boolean flag = true;
for (int j = 0; j < anIntArray658.length; j++) {
if (!Model.isCached(anIntArray658[j])) {
flag = false;
}
}
return flag;
} |
60428e1a-7441-413c-b79c-d62390c1bcc2 | 1 | public void updateUi(String yourPlayerId) {
updateUiPlayerId = yourPlayerId;
game.sendUpdateUI(new UpdateUI(yourPlayerId, playersInfo,
gameState.getStateForPlayerId(yourPlayerId),
lastGameState == null ? null : lastGameState.getStateForPlayerId(yourPlayerId),
lastMove, lastMove... |
6ab6fc40-23dd-4e0f-8b69-14a8f2c9bd2a | 2 | public DummySSLSocketFactory()
{
try
{
SSLContext sslcontent = SSLContext.getInstance("TLS");
sslcontent.init(null, new TrustManager[]{new DummyTrustManager()}, new java.security.SecureRandom());
factory = sslcontent.getSocketFactory();
}
catch (No... |
0842ff11-e6a5-4917-aaed-eea4584b8971 | 4 | protected void append(LoggingEvent event) {
if (!performChecks()) {
return;
}
String logOutput = this.layout.format(event);
appenderUI.doLog(logOutput);
if (layout.ignoresThrowable()) {
String[] lines = event.getThrowableStrRep();
if (lines != null) {
in... |
bf8a0daf-b80e-43d6-b312-fcd7d6b6cb34 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ClientMessage other = (ClientMessage) obj;
if (_name == null) {
if (other._name != null)
return false;
} else if (!_name.equals(other._n... |
09d17254-77bb-4b0b-999d-a20e5f5af365 | 9 | public int winner() {
// A player captured enought seeds
if (position[12] > 24)
return SOUTH;
if (position[13] > 24)
return NORTH;
if (position[12] == 24 && position[13] == 24)
return DRAW;
// The game hasn't ended yet
... |
e74aa8e7-d959-4cfb-b4e7-92fbaa892344 | 2 | private boolean go(Direction dirToGo)
{
try
{
StringBuffer output = new StringBuffer();
boolean hasMoved = CommandController.getPlayer().move(dirToGo, output);
printMessage(output.toString());
return hasMoved;
}
catch(Exception e)
{
if(e in... |
f923c8a5-14ec-43f2-9bd4-c5c8ae455550 | 9 | public FileView(Composite parent) {
this.canvas = new Canvas(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_BACKGROUND);
canvas.addMouseWheelListener(new MouseWheelListener() {
public void mouseScrolled(MouseEvent event) {
ScrollBar bar = canvas.getVerticalBar();
bar.setSelection(bar.getSelection() - ev... |
666aa3c6-451a-4207-b9e4-73eb852c572f | 6 | @Override
public boolean equals(Object obj) {
if(!(obj instanceof Result)) {
return false;
}
Result that = (Result) obj;
if(
this.coeff1==that.coeff1 &&
this.coeff2==that.coeff2 &&
this.gcd==that.gcd &&
this.errorFlag==that.errorFlag &&
this.err==that.err
) {return true;}
return false;
... |
8482222b-7939-4e86-bb18-4cd8742cd1cd | 3 | private void runGA() {
int generation = 1;
while (generation<=this.generations) {
System.out.println("Generation "+generation);
population.evaluate(fitnessFunction);
T populationFittest = population.getFittestIndividual();
if (generation == 1)
... |
a1bab904-8dd6-437c-91e0-c2354bbe919e | 1 | public String[] getAllPlayersName() {
ArrayList<String> names = new ArrayList<String>();
for (Player player : players) {
names.add(player.getName());
}
return names.toArray(new String[names.size()]);
} |
85a57699-d584-486e-b93e-efdf71be0018 | 9 | @Override
public int hashCode( )
{
final int prime = 31;
int result = 1;
result = prime * result + ( ativo ? 1231 : 1237 );
result = prime * result + ( ( codigo == null ) ? 0 : codigo.hashCode( ) );
result = prime * result + ( ( email == null ) ? 0 : email.hashCode( ) );
result... |
95da04f6-1247-4e52-b228-466ece1c6b87 | 5 | @Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof GeoPosition))
return false;
GeoPosition other = (GeoPosition) obj;
if (Double.doubleToLongBits(latitude) != Double.doubleToLongBits(other.latitude))
return false;
if ... |
72162136-8cae-46f6-9e8b-8725200bcc1e | 9 | private boolean sort()
{
// Obter pontuações
String contents = toString();
if(contents == null)
return false;
String[] scoresArr = contents.split( Util.EOL ); // Array de pontuações
int[] scoresVals = new int[ scoresArr.length ]; // Array com valores
String[][] scoresNomes = new String[ scoresArr.leng... |
aa2572e7-5c2c-44be-a1be-ffee229a176f | 5 | public void connect(boolean useXMPPConnection){
if (useXMPPConnection) {
Utils.printWithDate("XMPP Connection to: " + hostXMPP + " (Port " + portXMPP + ") ... ", Utils.DEBUGLEVEL.GENERAL);
ConnectionConfiguration xmppConfig = new ConnectionConfiguration(hostXMPP, portXMPP);
xmppConfig.setReconnectionAllowe... |
42b4d575-98dc-48e5-879b-c87ab80d63c7 | 7 | private FullHttpResponse performStatus() {
StatDAO stat = new StatDAO();
ResultSet resultSetTableIP = null;
ResultSet resultSetTableRedirect = null;
ResultSet resultSetTableRecentConnections = null;
// HTML head
StringBuilder message = new StringBuilder();
... |
adbb5afd-a89a-413e-9f39-f2781ed25b71 | 9 | public boolean validaEmail(String Email) {
boolean Validacao = true;
if ((Email.contains("@")) && (Email.contains(".")) && (!Email.contains(" "))) {
String usuario = new String(Email.substring(0, Email.lastIndexOf('@')));
String dominio = new String(Email.substring(Email.lastIn... |
9f5c8a06-2510-4a4b-a52c-6de606cb2ade | 4 | public int compareTo(Endpoint other) {
double length = Math.abs(value);
double otherLength = Math.abs(other.value);
double distance = length - otherLength;
if (distance == 0.0d)
{
if (type.ordinal() < other.type.ordinal())
{
return -1;
}
else if (type.ordinal() == other.type.ordinal()... |
fce7bfba-345c-4f0e-9de3-fc610c100479 | 1 | private boolean jj_2_23(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_23(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(22, xla); }
} |
7b6aa268-9a3b-4b2e-b069-b21cd17482d3 | 5 | public void WGResetWord(String sender, Command command) {
if(command.arguments.length == 4) {
Game game = getGame(command.arguments[1]);
if(game != null) {
User user = getUserByNick(game, command.arguments[2]);
if(user != null) {
for(... |
7c6b6d5f-8242-45ac-ae8f-6dc246535115 | 4 | @Override
public ValueType returnedType(ValueType... types) throws EvalException
{
// Check the number of argument
if (types.length == 1)
{
// If numerical
if (types[0].isNumeric() || types[0] == ValueType.NONE)
return types[0];
// if ... |
441a01b0-a3d2-4be0-9cc6-08bf88820d82 | 3 | private static void setValue(CuratorFramework client, String command, String[] args) throws Exception {
if (args.length != 2) {
System.err.println("syntax error (expected set <path> <value>): " + command);
return;
}
String name = args[0];
if (name.contains("/")) ... |
0794a64a-57bc-4b18-9ead-0fca69d45017 | 7 | public void run(){
//TODO gossip runs and interface events need to be synchronised
// Create demo interface
D = new DemoInterface();
D.showGui("PA300m1.svg");
// minimise side panel
D.gui.toggleSidePanelSize();
// add node click listener
... |
fa83d593-9ef6-4ff4-957c-dada6e77fdfa | 9 | public void collideCheck()
{
if (dead) return;
float xMarioD = world.mario.x - x;
float yMarioD = world.mario.y - y;
float w = 16;
if (xMarioD > -16 && xMarioD < 16)
{
if (yMarioD > -height && yMarioD < world.mario.height)
{
if... |
61fb8eca-2802-4b9a-aa33-51a5996cca3b | 0 | public Twitter() {
} |
de0cb686-3c57-4020-b8ce-921b13ae1b41 | 3 | @EventHandler(priority = EventPriority.LOWEST)
public void onLogin(PostLoginEvent e) {
ProxiedPlayer p = e.getPlayer();
if (!this.knownClientIPS.containsKey(p.getName())) {
this.knownClientIPS.put(plugin.clearifyIP(p.getAddress().toString()), p.getName());
}
if (plugin.ma... |
4f54a310-73e0-481a-b38f-9d96aef30519 | 4 | public Descriptor compile(SymbolTable table){
Descriptor d = null;
if(type instanceof IdentNode){
String s = ((IdentNode) type).getIdentName();
if(s.equals("integer")){
d = new SimpleTypeDescriptor(Type.INTEGER);
}
else if(s.equals("boolean")){
d = new SimpleTypeDescriptor(Type.BOOLEAN);
}
... |
10678e7c-78b1-42ab-b64d-96236134f7fa | 0 | public CompRegPumpingLemmaInputPane(RegularPumpingLemma l)
{
super(l, "<i>L</i> = {" + l.getHTMLTitle() + "} Regular Pumping Lemma");
} |
3ff534be-7838-4ecf-b9d4-8d99e860698b | 9 | @Override
public boolean equals(Object obj) {
boolean result= false;
Personajes myObj = (Personajes) obj;
if(this == obj) result= true;
if(obj == null || (this.getClass() != obj.getClass()))
result = false;
if((this.nombre == myObj.nombre) && (this.alias == my... |
439d0816-5596-4be1-aa69-90cef9e8d8a1 | 1 | public void setWindowInnerAnimation(Animation animation) {
if (animation == null) {
this.window_InnerAnimation = UIAnimationInits.INNERWINDOW.getAnimation();
} else {
this.window_InnerAnimation = animation;
}
somethingChanged();
} |
42e2c4c4-b2fb-4fc5-9d59-f881bd81f281 | 3 | public static void main(String[] args) {
Map<String, Integer> grades = new ArrayMap<>();
// Add a few entries into our grade map
grades.put("Andy", 76);
grades.put("John Doe", 95);
grades.put("Jane Doe", 98);
// Get the value of a few entries
System.out.println(grades.get("Andy"));
System.out.println(... |
0d0a64b9-c402-4f7d-b92b-3c7e2fa5615d | 0 | private StartRouter() {
// JFormDesigner - Action initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
putValue(NAME, "Iniciar Router");
putValue(SHORT_DESCRIPTION, "Iniciar Router");
putValue(LONG_DESCRIPTION, "Iniciar Router");
putValue(SMALL_ICON, new... |
b8ed9935-7d0a-4984-bb7a-824562d7b205 | 3 | public static int randomSelect(int[] array, int start, int end, int index){
if(start == end)
return array[start];
else{
int q = randomized_partiton(array,start,end);
int k = q - start +1;
if(k ==index)
return array[q];
else if(index < k)
return randomSelect(array,start,q-1,index);
el... |
b9e8f265-ec9c-42ba-887f-b1aaf3c314dc | 8 | public Term setPerference(Term term)
throws TermException
{
if (term.var == null) {
Operation op = term.operation;
Operation res = null;
if (!op.modName.equals(this.modName)) {
Operation[] ops = this.getOperationsWithName(op.getName());
for (int i=0; i<ops.length; i++) {
if (... |
2d4fe4b5-0fb3-4388-afc1-a61a4c365371 | 7 | public Deserializer getDeserializer(Class cl)
throws HessianProtocolException
{
if (ObjectName.class.equals(cl)) {
return new StringValueDeserializer(cl);
}
else if (ObjectInstance.class.equals(cl)) {
return new ObjectInstanceDeserializer();
}
else if (MBeanAttributeInfo.class.isAs... |
7a6a7916-67b5-47c2-ae4d-721554b85a72 | 8 | public static void main(String[] args) throws IOException {
// wget
// http://dumps.wikimedia.org/jawiki/20140503/jawiki-20140503-pages-meta-current.xml.bz2
// bunzip2 jawiki-20140503-pages-meta-current.xml.bz2
String wikiPagesMetaXmlFilePath = args[0];
String outPutDirPath = args[1];
File outPutDir = new... |
e7621068-cd5a-4383-abcc-f48c83735f7c | 5 | public static Genre getByName(String s) {
switch( s ) {
case "Drama": return DRAMA;
case "Kinderbuch": return KIDS_BOOK;
case "Lyrik": return LYRICS;
case "Roman": return NOVEL;
case "Sachbuch": return NONFICTION;
default:
throw new InvalidParameterException("There is no genre which has the specif... |
38a1a409-29e9-4f97-a7f4-811716ed91db | 0 | public ConnectEvent(Object client) {
super(client);
} |
03fc2542-253e-403e-908f-def81cad5461 | 6 | @EventHandler
public void BlazeMiningFatigue(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getBlazeConfig().getDouble("Blaze.Mini... |
67186d05-0320-4b0b-8ecc-bb5dff243387 | 1 | @Override
public String getTooltip()
{
String tooltip = name;
for (GroupOfUnits u: garisson.getUnits()) {
tooltip += "\n"+ u.type.name +" ("+u.getNumberDesc()+")";
}
return tooltip;
} |
6124b47c-a9af-469b-a7cf-137c5d7357b1 | 7 | public void renderItem(Graphics g, Entity entity, Item item)
{
if(item instanceof ItemSword || item instanceof ItemBow && entity != null)
{
float r = entity.getBB(entity.getCoords()).getBoundingCircleRadius();
Vector2f looking = entity.getLooking().copy().normalise().scale(r);
int n = ((int)((item.getText... |
88538946-2822-4e3c-b92c-98a27e6b2eec | 6 | private void calcGenomehs() {
genomenr = new int[popdata.chromCount()][][];
genomehs = new ArrayList<ArrayList<ArrayList<ArrayList<Integer>>>>(); //for each genome nr:
//which haplostructs in initorder have this genome nr (for both sides)
possiblePairCount = new int[popdata.chromCou... |
30ecf1e7-c298-4128-a8f6-ffb073af1a1c | 4 | private JMenu getUsersMenu() {
final JMenu usersMenu = new JMenu("Users");
//List of Users
try {
for (String user: client.getUsers()) {
JLabel label = new JLabel(user);
label.setBorder(BorderFactory.createEmptyBorder(2, 5, 3, 5));
users... |
833275e0-a3ee-41d8-8bcd-ef9d2a0ce99d | 8 | public static int getInverseTransfType(int type){
int inverse = 0;
switch (type){
case 0: inverse = 0;
break;
case 1: inverse = 3;
break;
case 2: inverse = 2;
break;
case 3: inverse = 1;
break... |
db904f08-da3f-4d18-a82e-cedf5d8cd832 | 5 | private Tile[] rotate(int dgr) {
Tile[] newTiles = new Tile[ROW * ROW];
int offsetX = 3, offsetY = 3;
if (dgr == 90) {
offsetY = 0;
} else if (dgr == 180) {
} else if (dgr == 270) {
offsetX = 0;
} else {
throw new IllegalArgumentExcepti... |
e7ad89d1-6bb8-4c08-ad84-ae5790a159ee | 4 | public static void main(String[] args) throws IOException {
StringBuilder sb = new StringBuilder();
BufferedReader buf = new BufferedReader(
new InputStreamReader(System.in));
String line = "";
d: do {
line = buf.readLine();
if (line == null || line.length() == 0)
break d;
sb.append(convery(lin... |
6e39541a-9067-4f66-b2c0-9456cea1477d | 2 | private static void findAllC2(int n){
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
allSwaps.add(new Point(i, j));
}
}
} |
90e33004-30ce-4541-bbb5-339dbbad9990 | 3 | public static String fetchURLGet(final String u, String parameters) {
String returnedString = "";
try {
final URL url = new URL(u + "?" + parameters);
final BufferedReader reader = new BufferedReader(
new InputStreamReader(url.openStream()));
String line;
while ((line = reader.readLine()) != null) ... |
7038cda8-c915-4252-ab7f-011add77c1f5 | 1 | public static void main(String[] args) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
String path = "resources/lena.png";
Mat image = Highgui.imread(path);
Mat out = new Mat();
if(image.empty()) {
System.out.println("Image not found !!");
return;
}
ImageUtils.displayImage(ImageUtils.... |
5530a917-c9cd-45b6-a1c5-5b3c76109bce | 1 | public static void setFoxCreationProbability(double FOX_CREATION_PROBABILITY)
{
if (FOX_CREATION_PROBABILITY >= 0)
Simulator.FOX_CREATION_PROBABILITY = FOX_CREATION_PROBABILITY;
} |
34c40813-adfa-424c-adc4-abd732e0444e | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Genero other = (Genero) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
r... |
7700eaf3-ae46-45ec-9af3-cf3b2b9affd7 | 1 | @Override
public void addRecordToDB() {
// add to database
try {
String statement = new String("INSERT INTO " + DBTable
+ " (qid, userid)"
+ " VALUES (?, ?)");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement, new String[] {"id"});
stmt.setInt(1, quiz.quizID);
stmt.setIn... |
5249862b-f652-471b-84d5-858931840786 | 1 | public void setComfortType(ComfortType comfortType)
throws CarriageException {
if (comfortType == null) {
throw new CarriageException("Comfort type is null");
}
this.comfortType = comfortType;
} |
0beab6dc-3c19-44ba-a98e-55c094ad3f08 | 7 | private int whitePosition(int i) {
int whitePos;
switch (i) {
case 1:
whitePos = 1;
break;
case 3:
whitePos = 2;
break;
case 5:
whitePos = 3;
break;
case 7:
whitePos = 4;
break;
case 8:
whitePos = 5;
break;
case 10:
whitePos = 6;
break;
case 0:
whitePos = 7;
... |
f4a5c257-c225-46a2-9242-376fdd0ceb04 | 0 | public GroupJoinIterator(Iterable<T> outer, Iterable<TInner> inner, Selector<T, TKey> outerKeySelector, Selector<TInner, TKey> innerKeySelector, Joint<T, TInner, TResult> joint, Comparator<TKey> comparator)
{
this._outer = outer;
this._inner = inner;
this._innerKeySelector = innerKeySelector;
this._outerK... |
16fc9460-de07-481e-b259-619889eb255c | 2 | public Neg(byte[] buf) {
int off;
cc = cdec(buf, 0);
bc = cdec(buf, 4);
bs = cdec(buf, 8);
sz = cdec(buf, 12);
bc = MapView.s2m(bc);
bs = MapView.s2m(bs).add(bc.inv());
ep = new Coord[8][0];
int en = buf[16];
off = 17;
for (int i = 0; i < en; i++) {
int epid = buf[off];
int cn ... |
338367a8-1046-401d-b7fc-b1c6c37b252b | 7 | @Override
public Attribute getBestAttribute(Attribute target,
ArrayList<Attribute> attributes) {
double entropyTarget = computeEntropy(target);
// System.out.println("Entropy Target -> " + entropyTarget);
// System.out.println();
Attribute bestAttribute = null;
Double bestValue = Double.NEGATIVE_INFINI... |
b63c9dda-9590-481d-9f8e-7c8dbb63c6e7 | 0 | public String getAlgorithm() {
return algorithm;
} |
1778d37c-e0f9-43f9-9e95-16b5e6feddc7 | 6 | public boolean connect() throws Exception
{
port = getPropPort();
portRate = 9600;
//Service.WriteLog("Find port: "+port);
parity = 0;
rts = true;
if (this.port.length()<1)
{
return false;
}
if (status == Device.DEVICE_READY || status =... |
3b21c87e-6175-4c1a-a42b-227327acf2db | 1 | private static boolean insertPatient(Patient bean, PreparedStatement stmt) throws SQLException{
stmt.setString(1, bean.getFirstName());
stmt.setString(2, bean.getLastName());
stmt.setDate(3, bean.getDob());
stmt.setString(4, bean.getPrimaryDoc());
stmt.setString(5, bean.getPhone());
stmt.setString(6, bean.... |
6b75ec92-2b5d-4711-b348-1739829a7059 | 0 | public Object get(int i){
return vector.get(i);
} |
128c61bd-376f-4c22-a197-a3e0a6fce9b0 | 7 | public void resizeColumns()
{
if (_vertical)
{
TableColumn column = _table.getColumnModel().getColumn(1);
int origWidth = column.getWidth();
int width = origWidth;
Font font = _table.getFont();
FontMetrics fontMetrics = _table.getFontMetric... |
7e7ab07c-8246-4bcf-bf48-47b3984b2844 | 7 | protected void switchToBars() {
if (m_plotSurround.getComponentCount() > 1 &&
m_plotSurround.getComponent(1) == m_legendPanel) {
m_plotSurround.remove(m_legendPanel);
}
if (m_plotSurround.getComponentCount() > 1 &&
m_plotSurround.getComponent(1) == m_attrib) {
... |
f23903a7-0cb2-4b7f-a79f-fb04d0da536c | 4 | private Object handlePrim(Object tos) {
if ((tos instanceof Media && ((Media)tos).getPrimary() == null) ||
(tos instanceof ParentFamilyRef && ((ParentFamilyRef)tos).getPrimary() == null)) {
return new FieldRef(tos, "Primary");
}
return null;
} |
88476bb5-a034-423c-82e7-a315b751d52d | 2 | public boolean allVisitedMore(int comp)
{
for (Action a : actions)
if (a.getVisits() < comp)
return false;
return true;
} |
4ba346d2-090a-4a06-ac26-d8604100ee85 | 6 | private void drawVoltageGrid(Graphics g) {
ArrayList<Double> list = makeList(voltageValue);
Collections.sort(list);
double belowZero = getNegativeAmount(list);
double exactlyZero = getZeroAmount(list);
double aboveZero = getPositiveAmount(list);
for(int x = width/6 +5; x < width*5/6 -10; x+=pixel){
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.