method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a509b4bb-02e5-4689-91f0-8b4424a9c2e2 | 7 | protected void generateCode() {
List<Invalid> errors = validateData();
if (!errors.isEmpty()) {
displayValidationErrorDialog(true, errors);
return;
}
JFileChooser save = new JFileChooser();
save.setAcceptAllFileFilterUsed(false);
save.setFileFilter(new FileNameExtensionFilter("JAR files", "jar"));
... |
83e0dac7-cdbf-4949-87ed-ce74164e3f4c | 7 | private void setupNewStyle(final String installPath, final ModPack pack)
{
List<DownloadInfo> assets = gatherAssets(new File(installPath), pack.getMcVersion());
if (assets.size() > 0)
{
final ProgressMonitor prog = new ProgressMonitor(this, "Downloading Files...", "", 0, 10... |
16de0858-3ba9-4eef-b7b2-62d1bb8e0353 | 7 | public static String checkForLauncherUpdates(boolean verbose, String currentVersion, JSONObject versionsConfig) {
if (Util.versionIsEquivalentOrNewer(currentVersion, versionsConfig.get("latestmoddle").toString())) {
//Jump out if the launcher is up to date
Logger.in... |
e4ad0593-74f3-4c6c-ba0f-3bf12eed5c2c | 8 | public Course(String[] parameters){
this.shortName.add(parameters[0]);
setName(parameters[1]);
if (!parameters[2].isEmpty()) {
String[] crosslisted=parameters[2].split(",");
for(String s:crosslisted) {
this.shortName.add(s);
}
}
if (parameters[4].equals("LAB")){
setType("lab");
} else {
s... |
2112599c-a605-44f2-a09a-dd53d30d07b5 | 2 | public boolean isSet(int i, int j){
boolean c = false;
if (board[i][j].equals("X") || board[i][j].equals("O")) c=true;
else c=false;
return c;
} |
c6bc4664-64b1-459d-9a9c-e9d94b0e3f20 | 5 | public static void addListenerToAllComponents( String listenerName, EventListener listener, Component c ) {
if( c == null )
return;
try {
Class[] classes = listener.getClass().getInterfaces();
if( classes.length > 0 ) {
Method addListenerMethod = c.get... |
5c7b0d46-becd-4935-b167-7b35a908f679 | 5 | public int getNumberDisjoint(Organism organism2) {
int D = 0;
int maxNumberShortGenome, counterInnovNumber, i = 0, j = 0;
if (organism2.getLastGeneInovNumber() > this.getLastGeneInovNumber()) { //this - short genome
maxNumberShortGenome = this.getGenome().lastGeneInovNumber();
... |
cd47f4f0-df84-4008-8b4b-4bc149346227 | 8 | private void clickMouse(final Gamepad gamepad) {
if (gamepad.isPressed(5) && !mouseLeftDown) {// R1 = left click
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
mouseLeftDown = true;
System.out.println("Left Mouse Clicked");
}
if (!gamepad.isPressed(5) && mouseLeftDown) {
robot.mouseRelease(InputEvent... |
fb0d0a79-93f8-4a6d-b8f1-d71ced8cee48 | 0 | private Body() {
super(10);
initComponents();
} |
ddc14b30-9301-4e12-bbd7-a2e4decaece6 | 2 | public String[][] getAllValues() throws IOException {
if (labels == null) setLabels();
String[][] allValues = parse.getAllValues();
if (allValues == null){
lastLine = null;
} else {
lastLine = allValues[allValues.length-1];
}
return allValues;
... |
912662d6-5e16-4e9d-9648-99eaaef2371b | 7 | private Image getFarbigenDrLittle(String name)
{
BufferedImage drlittle = ladeBild(getClass().getResource(
"bilder/drlittle.png"));
Color farbe = _spielerfarben.get(name);
if(farbe != null)
{
for(int i = 17; i < 54; i++)
{
for(int j = 0; j < 54; j++)
{
if(drlittle.getRGB(j, i) == Color.... |
9b0f7ad0-4216-494e-b0cb-6e906812d02d | 0 | public E min() {
final E returnValue = (E) heap.get(0);
return returnValue;
} |
205db324-9b8e-432c-a9c5-321c57daffc3 | 3 | @Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
if(e.getMessage() instanceof HandshakeRequestEvent) {
Actions.addAction(new Action(ActionType.INFO, "Received handshake from Connection, validating..."));
/* Create a new NetworkEvent */
NetworkEvent ... |
aef3f9a0-3ce9-42a6-a06a-9f3e4b554a36 | 2 | private void blitNumber(int number, int x, int y) {
if (numbers!=null) {
String sNum=Integer.toString(number);
for (int i=0; i<sNum.length(); i++) {
char cNum=sNum.charAt(i);
int iNum=cNum-48;
buffer.blit(numbers, iNum*5, 0, x, y, 5, 9, FrameBuffer.TRANSPARENT... |
926c534a-4d87-4e9d-b3ab-60d4ad6cdc58 | 6 | public Core(String[] args) throws Exception { // XXX main : Working
System.out.println("FabFileConverter V" + version + " Beta started.");
System.out.println("Programm path : " + pluginHandler.getApplicationPath());
for (int i = 0; i < args.length; i++) {
System.out.println(" args[" + i + "] - " + args[i]);
... |
eb80578c-5ab5-4cfd-beee-171353bee688 | 6 | private JComboBox<EnumValue> createCombo(EnumList p_enumList)
{
JComboBox<EnumValue> l_combo = new JComboBox<EnumValue>();
l_combo.addPopupMenuListener(new PopupMenuListener() {
public void popupMenuWillBecomeVisible(PopupMenuEvent p_e)
{
}
public void popupMenuWillB... |
866d151c-70e8-4ca9-9d4b-7163e9dc28e4 | 4 | public TableModel Update() {
String columnNames[] = { "ID","Nom","Prenom","Situation","Adresse","Classe"};
DefaultTableModel defModel = new DefaultTableModel();
defModel.setColumnIdentifiers(columnNames);
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDr... |
ede05529-5166-403a-83ba-6761ec73da78 | 4 | public static String readTextFromReader(final Reader reader) {
StringBuffer sb = new StringBuffer();
char[] buf = new char[1024 * 4];
int readLen;
try {
while (-1 != (readLen = reader.read(buf))) {
sb.append(buf, 0, readLen);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (... |
ef38bc47-1308-4f8f-8d19-516da551b539 | 8 | protected void updateCapabilitiesFilter(Capabilities filter) {
Instances tempInst;
Capabilities filterClass;
if (filter == null) {
m_ClassifierEditor.setCapabilitiesFilter(new Capabilities(null));
return;
}
if (!ExplorerDefaults.getInitGenericObjectEditorFilter())
tempInst... |
a53752c9-d83a-48fd-84e9-91e93de12aa2 | 6 | public void process(WikiArticle page, Siteinfo siteinfo)
throws SAXException {
if (page != null && page.getText() != null
&& !page.getText().startsWith("#REDIRECT ")) {
// Zap headings ==some text== or ===some text===
// <ref>{{Cite
// web|url=http://tmh.floonet.net/articles/falseprinciple.ht... |
27219fd3-ec6b-4a57-9d31-5d47f3614123 | 6 | public static void main( String[] argv ) {
//String msg = "Hallo, das ist ein Test.";
//byte[] data = msg.getBytes();
byte[] data = new byte[256];
for( int i = 0; i < data.length; i++ )
data[i] = (byte)i;
int size = data.length;
System.out.println( "Creating buffer (size="+ size + ") ..." );
Circular... |
83af9462-011e-4e49-b245-6ffe96227186 | 1 | public static <E extends Enum<E>>E lookup (Class<E> e, String id ){
try {
E result = Enum.valueOf(e, id.toUpperCase());
return result;
} catch (IllegalArgumentException e2) {
return null;
}
} |
9daa5b59-ce3c-4ee3-b27f-60925ab97b85 | 9 | public void makeKey() {
BufferedReader standardInput = launcher.openStandardInput();
boolean accepted = false;
// Frage jeweils solange die Eingabe ab, bis diese akzeptiert werden kann.
do {
Logger("Geben Sie den Modulus ein: ");
try {
modulus = Integer.parseInt(standardInput.readLi... |
8e14a3fe-f9b9-49ec-a1b5-9eb158bf04c4 | 5 | public static String[] splitIKRSMD5( String str )
throws NumberFormatException {
// Format (example):
// keel:${ikrs.http.MD5}$12345678$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
String[] split = str.split( "(\\$)" );
if( split.length != 4 )
throw new NumberFormatException( "The string is not an ikrs-MD5 sum (cod... |
7ec8bdf1-47fb-41e2-8b0b-edd88c494d9a | 8 | public void add(Force f) {
double myX = this.getX();
double hisX = f.getX();
double myY = this.getY();
double hisY = f.getY();
double newX = myX + hisX;
double newY = myY + hisY;
this.magnitude = Math.pow(Math.pow(newX, 2) + Math.pow(newY, 2), 0.5);
if (newX == 0) {
if (newY > 0) {
direction = ... |
f758986a-fc26-400e-aeb7-fcdccd3983e4 | 5 | public void fadeOutIn(FilenameURL filenameURL, long milisOut, long milisIn) {
if (filenameURL == null) {
errorMessage("Filename/URL not specified in method 'fadeOutIn'.");
return;
}
if (milisOut < 0 || milisIn < 0) {
errorMessage("Miliseconds may not be negative in method "
+ "'fadeOutIn'.");
ret... |
c3f66c80-a443-4abf-a424-1a22b235309d | 5 | private void portamento_down() {
if( ( portamento_param & 0xF0 ) == 0xE0 ) {
/* Extra-fine porta.*/
if( effect_tick == 0 ) {
set_period( period + ( portamento_param & 0x0F ) );
}
} else if( ( portamento_param & 0xF0 ) == 0xF0 ) {
/* Fine porta.*/
if( effect_tick == 0 ) {
set_period( period +... |
1312004e-f952-4afc-a96c-9a3a504dfc59 | 8 | public void renderRaisedMob(int xp, int yp, Sprite s) {
int w = s.W;
int h = s.H;
xp -= xOffs;
yp -= yOffs;
int[] iso = twoDToIso(xp, yp);
xp = iso[0];
yp = iso[1] - 20;
for (int y = 0; y < h; y++) {
int ya = y + yp - h; // absolute position
... |
b1e7d8ca-510e-4eaa-ba72-bcae82f0a8c2 | 2 | public void visitShiftExpr(final ShiftExpr expr) {
if (previous == expr.expr()) { // the expression to be shifted is like
previous = expr; // the left child
expr.parent().visit(this);
} else if (previous == expr.bits()) {
check(expr.expr()); // the right child
}
} |
9fd4de24-c6bc-4e24-9dd2-9d40e279a137 | 8 | public void processFile() throws IOException {
if (displayInfo) {
System.out.println(" *** tape info:");
System.out.println(" " + getTapeRecord().toString());
for (FileRecord fileRecord : getFileRecords()) {
System.out.println(" *** file record:");
... |
d5fba830-d817-4fe6-89cc-ab69cecb5a4f | 0 | public void enable() {
disabled = false;
} |
ce243662-4378-4b5a-8631-87c85b4d5e20 | 9 | public String getRepeatedCharsAsString(String one, String two) {
Map<Character, Integer> charFrequency;
StringBuilder builder = new StringBuilder();
String longer;
if (one.length() > two.length()) {
charFrequency = makeCharFrequencyMap(two);
longer = one;
... |
4d967e07-ef18-4713-8a4b-4dfd4fa2ed46 | 9 | public InvitePk insert(Invite dto) throws InviteDaoException {
long t1 = System.currentTimeMillis();
// declare variables
final boolean isConnSupplied = (userConn != null);
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
// get the user-specified connection or get a connec... |
6fc69ef2-e9a1-4e00-a0a1-ad4c53d55316 | 3 | public void paint(Graphics g)
{
if (previewState != null)
{
mxGraphics2DCanvas canvas = graphComponent.getCanvas();
if (graphComponent.isAntiAlias())
{
mxUtils.setAntiAlias((Graphics2D) g, true, false);
}
float alpha = graphComponent.getPreviewAlpha();
if (alpha < 1)
{
((Graphics2D)... |
781ac2c5-ab7f-472a-8867-88c8a0890f46 | 4 | void probabilities() {
// Already done, nothing to do
if (prob != null) return;
// Get total length and count for chromosomes (chromosome size is total genome length)
String chrType = Chromosome.class.getSimpleName();
long chrSize = countBases.get(chrType);
long chrCount = countMarkers.get(chrType);
if (... |
dee66b2a-2b09-4b8a-b266-85dcce9a6c45 | 9 | private void setOriginServer(ConfigurationCommands command,
String[] parameters) {
POPXY popxy = POPXY.getInstance();
User user = null;
String[] serverAndPort = parameters[0].split(":");
Integer port = null;
if (serverAndPort.length == 2) {
port = Integer.parseInt(serverAndPort[1]);
}
// Se le se... |
4521f4e7-9706-4a1b-928b-b577d4a4091b | 7 | public void PhysicsSolve ()
{
// capture Image
BufferedImage screenshot = ActionRobot.doScreenShot();
// process image
VisionRealShape vision = new VisionRealShape(screenshot);
// get all object
List<ABObject> objects = vision.findObjects();
List<ABObject> pigs = vision.findPigs();
List<ABObject> bir... |
13abf279-565f-465b-82ee-fbafbfd0a21b | 8 | public void fixTile() {
if (stop) {
return;
}
if (!board.isGameOver() && !playPanel.isAnimating()) {
playPanel.fixCurrentTile();
scorePanel.repaint();
if (board.isGameOver()) {
if (board.getWinner() > -1) {
cheers.play();
}
playPanel.displayResult();
} else if (board.getPlayers()[b... |
d4ab30a9-77d2-4d08-8c4c-c91903de5138 | 7 | private synchronized void receiveAd(Sim_event ev)
{
if (super.reportWriter_ != null) {
super.write("receive router ad from, " +
GridSim.getEntityName(ev.get_src()));
}
// what to do when an ad is received
RIPAdPack ad = (RIPAdPack)ev.get_data();
... |
b5b0bff4-b88d-4ffd-bdc6-729887f09d91 | 7 | public static String getAlias(Class<? extends ConfigurationSerializable> clazz) {
DelegateDeserialization delegate = clazz.getAnnotation(DelegateDeserialization.class);
if (delegate != null) {
if ((delegate.value() == null) || (delegate.value() == clazz)) {
delegate = null;
... |
58eea030-ebb3-464a-90cc-5a9be23fb379 | 9 | void build( CodeWriter src, CodeWriter res ) throws IOException {
// write classes
for (JDefinedClass c : classes.values()) {
if (c.isHidden())
continue; // don't generate this file
JFormatter f = createJavaSourceFileWriter(src, c.name());
f.write(... |
d20d415c-d28d-4408-a549-b0f5652d15d8 | 4 | public void calcTEmodeEffectiveRefractiveIndices(){
this.effectiveRefractiveIndicesTE = new double[this.numberOfTEmeasurementsGrating];
this.effectiveErrorsTE = new double[this.numberOfTEmeasurementsGrating];
if(!this.setSuperstrateRI){
this.superstrateRI = RefractiveIndex.air(super... |
165184ea-4fe4-43c6-ba08-840dad8f6b69 | 1 | public boolean addElement(Element elem) {
if (filled + elem.getValue() <= capacity) {
filled += elem.getValue();
elements.add(elem);
return true;
}
return false;
} |
2b9bc08d-f6e1-40cf-b017-ff03f82b6fc3 | 1 | @Override
public String toString() {
NumberFormat formatter = new DecimalFormat("0.#####E0");
return "\n" + "NaturalSatellite{" +
"id=" + id +
", name='" + name + '\'' +
", mass=" + formatter.format(mass) +
(inhabited ? ", population=" ... |
232e61a4-1f75-4019-9456-fb247ea88f16 | 3 | void WFext( double[][] A)
{
edge f, g;
if ( head.leaf() && tail.leaf() )
distance = A[head.index][head.index];
else if ( head.leaf() )
{
f = tail.parentEdge;
g = siblingEdge();
distance = 0.5*(A[head.index][g.head.index]
+ A[head.index][f.head.index]
- A[g.head.index][f.head.index]);
... |
c347a3ff-9234-4df9-a739-bc64029a9bac | 9 | * @throws ArithmeticException if numeric overflow occurs
*/
@Override
public YearMonth plus(PlusAdjuster adjuster) {
return (YearMonth) adjuster.doPlusAdjustment(this);
} |
71566bb8-58e3-44ca-b1cf-c644acc12fbf | 0 | private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
// TODO add your handling code here:
}//GEN-LAST:event_formComponentShown |
cf48936e-c0d2-4c78-b7de-c2a38e047b09 | 6 | private <T> T createBean(ResultSet rs, Class<T> type,
PropertyDescriptor[] props, int[] columnToProperty)
throws SQLException {
T bean = this.newInstance(type);
for (int i = 1; i < columnToProperty.length; i++) {
if (columnToProperty[i] == PROPERTY_NOT_FOUND) {
... |
02cb6ad0-6726-4a2a-b2b8-e8cc5b47a9e5 | 2 | public void update(int delta) {
if(this.elapsedTime >= this.delay) {
if(this.currentAnimation < this.animation.size() -1) this.currentAnimation++;
else this.currentAnimation = 0;
this.elapsedTime = 0;
} else {
this.elapsedTime += delta;
}
//Testing:
this.position.add(new Vector2f(-2,0));
t... |
f53465c3-0ac6-4798-bd5d-03a03a6e9395 | 9 | private EntityObject AddObjectToDB(EntityObject obj)
throws DataProviderAddingException {
if (!obj.getClass().isAnnotationPresent(Entity.class)) {
throw new DataProviderAddingException(obj.getClass());
}
boolean generated = true;
// is id auto generated
... |
734d91b5-7793-4921-b607-c7473f7d0b69 | 8 | @Override
public Object getTeleportPacket(Location loc) {
Class<?> PacketPlayOutEntityTeleport = Util.getCraftClass("PacketPlayOutEntityTeleport");
Object packet = null;
try {
packet = PacketPlayOutEntityTeleport.getConstructor(new Class<?>[] { int.class, int.class, int.class, int.class, byte.class, byte.cl... |
1538258a-73a2-4aa0-9513-55cfaac56a8c | 4 | private File getConfigFile(String file) {
if (file.isEmpty() || file == null) {
return null;
}
File configFile;
if (file.contains("/")) {
if (file.startsWith("/")) {
configFile = new File(plugin.getDataFolder()
+ file.re... |
521b5111-fd77-40c5-bfc7-c4b495bc9501 | 6 | private void removeMode(final Theory theory, final String str) throws ParserException {
int l = -1;
if ((l = str.indexOf(DflTheoryConst.SYMBOL_MODE_CONVERSION)) > 0) {
try {
String o = str.substring(0, l).trim();
String[] c = str.substring(l + DflTheoryConst.SYMBOL_MODE_CONVERSION.length()).split(
... |
63c4bd27-c84b-49e0-9097-962eae2e70e9 | 1 | public Object get(String key) throws JSONException {
Object o = opt(key);
if (o == null) {
throw new JSONException("JSONObject[" + quote(key) +
"] not found.");
}
return o;
} |
ce13bd2b-d9ec-44ab-979b-0e415e548601 | 8 | public void getUserInfo(int offset, String postfix, int startIdx, int endIdx) {
CommonLogger.logger.info("--------begin users' information collection--------");
OAuthRequest req = null;
BufferedWriter userInfoWriter = null, errorWriter = null;
String tName = Thread.currentThread().getName();
try {
userI... |
93fe9565-c7e5-4a34-9d05-dba99d14be1a | 2 | public void addEvent(Event event) {
events.add(event);
switch (event.getType()) {
case Event.MARRIAGE:
if (marriage == null)
marriage = event;
break;
}
} |
a1b57f9e-0257-42cf-84f6-fabea7a1ec19 | 2 | public void displayTerrainData(Tile tile) {
if (tile == null) {
label.setText("None");
} else if (tile.hasStatus(TileStatus.Type.BLOCKED)) {
label.setText(TileStatus.Type.BLOCKED.toString() + "(" + tile.getStatusDuration(TileStatus.Type.BLOCKED) + ")");
} else {
label.setText("Normal terrain");
}
} |
29b1447c-373f-41f1-9013-094a899d27e3 | 5 | @Override
protected boolean canRun(ClassNode node) {
if (classNodes.containsKey("LinkedList"))
return false;
int fieldCount = 0;
int nodeCount = 0;
ListIterator<FieldNode> fnIt = node.fields.listIterator();
while (fnIt.hasNext()) {
fieldCount++;
... |
2ad2928d-cf9c-45ad-8030-014312dc8ffb | 0 | private Seasons(String name, int id) {
this.name = name;
this.id = id;
} |
ed60aead-6b51-40da-8366-f6be5c32ac4a | 6 | private void fillComponents() {
for (int i = 0; i < componentList.size(); i++) {
// Fill text components
if (componentList.get(i) instanceof Text) {
((Text) componentList.get(i)).setText(row.getElementAt(i));
// Fill table viewer components
} else if (componentList.get(i) instanceof DetailedAttr... |
e5acfb49-7799-4b8f-a379-f776f21888fd | 4 | private int getColorValue(String inputComponent, BufferedImage image, int x, int y) {
int value;
switch (inputComponent) {
case "a":
value = getA(image, x, y);
break;
case "r":
value = getR(image, x, y);
break;
... |
d26a1634-a6c9-4037-802c-cdc4ea691f79 | 4 | public void mouseMoved(MouseEvent e) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: mouseMoved() BEGIN");
}
m_colX = (e.getX() / getSquareWidth()) * getSquareWidth();
m_colY = (e.getY() / getSquareHeight()) * getSquareHeight();
m_nextColX = (e.getX() / getSquareWid... |
4068db9b-032b-4bac-9754-3cf52297b467 | 0 | @Override
public PermissionType getType() {
return PermissionType.GROUP;
} |
a8c44f1c-be38-40da-91b0-26840d15356b | 9 | @SuppressWarnings("unchecked")
public void run() {
log.info("Attempting to connect to chat server...");
try {
socket = new Socket(plugin.getConfig().getString("chat-server"), 51325);
out = new DataOutputStream(socket.getOutputStream());
in = new DataInputStream(socket.getInputStream());
} catch (Unknown... |
8bf2cc6f-b10d-477c-b402-908da65770a1 | 4 | public double calculateEnergyConsumptionEP(SoftwareSystem system, FunctionalRequirement functionalRequirement, SequenceAlternative sequenceAlternative) {
double consumption = 0;
system.getActuallyUsedHardwareSets().clear();
for (Message message : sequenceAlternative.getMessages()) {
double componentConsumption... |
e8d6c187-7ec6-41f4-b492-f8ed9f36b094 | 2 | public void onEnable(){
loadConfig();
this.getCommand("RageQuit").setExecutor(new RageQuitCommand(this));
this.getCommand("rq").setExecutor(new RageQuitCommand(this));
this.getCommand("hug").setExecutor(new HugCommand(this));
this.getCommand("kiss").setExecutor(new KissCommand(this));
th... |
39405cc4-e8b1-4a71-ad2e-38811e5ebd57 | 5 | ServerFrame(String professorName,String departmentName,String subjectName,String topicName) throws IOException
{
super("Class Room Interaction");
/*
File image2=new File("Images/mic_icon.png");
System.out.println("hello lavish kothari");
try {
Image image = ImageIO.read(image2);
this.setIconImages((... |
aa527d40-4d83-41f6-a28a-5c38e06b995c | 8 | protected Casella obertura()
{
if ( partida.getTornsJugats() == 0 )
{
return new Casella( 4, 2 );
}
Casella fitxa_posada = null;
// Busquem quina és la fitxa que ha posat l'altre jugador
int fila = 0;
while ( fitxa_posada == null && fila < partida.getTauler().getMida() )
{
int columna = 0;
w... |
4722cae5-d5a4-4efe-88d6-3b2640e98adf | 6 | private boolean versionCheck(String title)
{
if(type != UpdateType.NO_VERSION_CHECK)
{
String version = plugin.getDescription().getVersion();
if(title.split(" v").length == 2)
{
String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ... |
53a2930a-1ce6-4f71-9b99-4f8cd8697eca | 4 | private List<Node> closestNodesNotFailed(Byte status)
{
List<Node> closestNodes = new ArrayList<>(this.config.k());
int remainingSpaces = this.config.k();
for (Map.Entry e : this.nodes.entrySet())
{
if (!FAILED.equals(e.getValue()))
{
if (stat... |
6b9b7967-a5e3-4402-b767-a50a1d936be5 | 3 | public int[] search(int[] a, int k){
if(a==null || k>a.length) return new int[0];
int[]result=new int[k];
int cur=-1;
for(int i=0;i<k;++i){
cur=max(a,cur,a.length-k+1+i);
result[i]=a[cur];
}
return result;
} |
020aacb8-cb6a-4dbb-875d-e12ef65da5ce | 9 | public static void saveRentTransaction(RentTransaction rentTransaction){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
conn.setAut... |
831c3547-2be4-46da-afb8-91f4e27db153 | 6 | public AudioDevice createAudioDevice() throws JavaLayerException
{
AudioDevice device = null;
AudioDeviceFactory[] factories = getFactoriesPriority();
if (factories==null)
throw new JavaLayerException(this+": no factories registered");
JavaLayerException lastEx = null;
for (int i=0; (device==null) &... |
bf017195-dd41-47b8-a156-b0352c6c44f6 | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, AccessLevel__typeInfo)) {... |
3660e985-7378-4547-884f-01bed02c39ac | 3 | public void mapObjectToPSTM(PreparedStatement pstm, T bean, String... labels) throws SQLException, NoSuchColumnLabel {
for( int i = labels.length; i>0; i-- ){ //fields are identified from 1 for preparedStatement.setXX()
String s = labels[i-1];
try {
mapObject(pstm, i, getters.get(s).invoke(bean));
} c... |
7ead5a11-10e6-4555-b8d0-ad5b68c3e041 | 3 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this);
if ((clipboardContent != null)
&& (clipboardContent.isDataFlavorSupported(DataFla... |
0516126b-f5c0-455a-8950-df33e764d541 | 8 | @Override
public void init(GameContainer container, StateBasedGame sbg)
throws SlickException {
//Init Resources
if(!Globals.RESOURCES_INITIATED){
Checkers.initRessources();
}
//GameType Box
gameTypeBox = new GameTypePrompt();
gameTypeBox.pvaiButton = new MouseOverArea(container, ResourceManager.... |
99cb9618-1d89-4ecf-a636-917eb255290e | 7 | public boolean importData(JComponent jcIn, Transferable tIn)
{
if (! this.canImport(jcIn, tIn.getTransferDataFlavors()))
{
return false;
}
try
{
EzimMsgOut emoTarget = null;
Object objTmp = null;
emoTarget = (EzimMsgOut) jcIn.getParent().getParent()
.getParent().getParent().getParent();
... |
8fa90445-6756-4ac6-b283-05e48bb05ee8 | 7 | public MovieSubtitles parseSubtitlies(String fileName)
throws SubtitlesParserException {
MovieSubtitles result = new MovieSubtitles();
InputStream inputStream = getClass().getClassLoader()
.getResourceAsStream(fileName);
if (inputStream == null) {
try {
inputStream = new FileInputStream(fileName);
... |
390c0917-e231-4bec-9da1-4ed2e2e6b05f | 4 | private boolean EsTelefonoCorrecto(String entrada_Telefono){
char Numero;
boolean TelefonoCorrecto = true;
boolean TelefonoIncorrecto = false;
if(entrada_Telefono.equals("")){
return TelefonoIncorrecto;
}else{
for(int Indice=0; Indice < entrada_Telefono... |
5bab01a3-feae-40a3-9b20-2c27b2667d1e | 0 | private void updateStatus() {
pane.stackDisplay.setText(stackString());
pane.inputDisplay.setText(STRING.substring(P));
} |
60329126-4c2d-461d-ad1b-2fadb4b03863 | 5 | public String buildUrl(User user, VerifyImage img){
StringBuffer url = new StringBuffer();
// TODO 这里有待修改
// String urlV4 = this.fetionContext.getLocalSetting().getNodeText("/config/servers/ssi-app-sign-in-v2");
LocalSetting localSetting = new LocalSetting();
try {
localSetting.load(user);
} catch (IOE... |
01d6516c-34d8-4611-aeee-f833d1708137 | 1 | private static String array2Str(Object[] source) {
StringBuffer buffer = new StringBuffer();
for (Object object : source) {
buffer.append(" ").append(object + "");
}
return buffer.toString();
} |
d05bd5df-7e2b-46fc-8aeb-91cba43a8562 | 8 | private void validaEntrada(int row, int col) {
switch (col) {
case 0:
Boolean inicia = (Boolean) tabelaAF.getValueAt(row, col);
if (inicia) {
for (int i = 0; i < modeloTabelaAF.getItens().size(); i++) {
if (((Boolean) modeloTabelaAF.getItens().get(i).get(0)) && row != i) {
JOptionPane.showMessa... |
92f6fc48-179d-42bc-98ba-2145c5fc3244 | 3 | public void gumbelMaxProbabilityPlot(){
this.lastMethod = 6;
// Check for suffient data points
this.gumbelMaxNumberOfParameters = 2;
if(this.numberOfDataPoints<3)throw new IllegalArgumentException("There must be at least three data points - preferably considerably more")... |
60625c03-fb6a-43ac-83d8-ba603084aa44 | 9 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
if((msg.amITarget(mob))
&&(msg.targetMinor()==CMMsg.TYP_WEAPONATTACK)
&&(amountOfShieldArmor>0)
&&(mob.isInCombat())
&... |
41a45811-8671-44d5-83c4-f9713d9bff94 | 0 | @Test
public void testGetInstruction() throws IOException {
System.out.println("getInstruction");
AntBrain ab = new AntBrain("cleverbrain1.brain");
Ant instance = new Ant(ab,true,0);
Sense expResult = new Sense(Sense.dirFromString("here"),32, 1,Sense.condFromString("home"));
... |
d5ac4b32-ad29-45db-97c3-084278291633 | 9 | private String expFormat(double d) {
String f = "";
int e = 0;
double dd = d;
double factor = 1;
while (dd > 10) {
e++;
factor /= 10;
dd = dd / 10;
}
while (dd < 1) {
e--;
factor *= 10;
dd = ... |
9d0a0295-e561-4420-b6dc-a0a95d502c4e | 2 | @Override
public String toString() {
StringBuffer sb = new StringBuffer(qname + "\t" + flag //
+ "\t" + rname //
+ "\t" + pos //
+ "\t" + mapq //
+ "\t" + cigar //
+ "\t" + rnext //
+ "\t" + pnext //
+ "\t" + tlen //
+ "\t" + seq //
+ "\t" + qual);
// Apend tags
for (int i = ... |
8ba4f239-4d9c-45f9-87d9-3229a50cff20 | 9 | public void addMonster(){
int x;
int y;
String s = (String)JOptionPane.showInputDialog(
mainWindow,
"Give x and y coordinates\n"
+ "Seperated by /",
"Add monster",
JOptionPane.PLAIN_MESSAGE,
null,null,"");
if ((s ... |
8ec560c9-9a29-44bb-b199-e330baa873b1 | 6 | public static Proposition updateProperty(LogicObject self, Surrogate surrogate, Keyword updatemode) {
{ Proposition value000 = null;
{ Proposition p = null;
Iterator iter000 = Logic.unfilteredDependentPropositions(self, surrogate).allocateIterator();
loop000 : while (iter000.nextP()) {
... |
cc54ab6a-fa1e-4929-aee3-7b681a3eb5bf | 5 | private void RunTasks()
{
// TODO Auto-generated method stub
try
{
//System.out.println("In Run Tasks " + new Date().toString());
if(this._states!=null && this._states.size()>0)
{
//System.out.println("Total no of states " + this._states.size());
if(_currentState==null)
{
_currentState... |
338f4589-9480-43af-9f96-2593e93aecf5 | 6 | private void loadNatives()
{
log("Loading Natives...");
String os = System.getProperty("os.name").toLowerCase();
String folder = "";
if (os.indexOf("win") >= 0)
{
log("OS: Windows");
folder = "windows";
}
else if (os.indexOf("mac") >= 0)
{
log("OS: Mac");
folder = ... |
89ca80a1-8fef-40d9-83bf-4edb0ab26165 | 3 | private void endStep() {
ArrayList<Player> losingPlayers = new ArrayList<Player>();
for (Player p : this.players) {
if (p.checkHasLost()) {
// System.out.println("Player " + p.getPlayerNumber()
// + " has lost the game.");
losingPlayers.add(p);
}
}
for (Player p : losingPlayers) {
this.play... |
2b1b6f1a-21fe-48a0-afcf-fbb3dac7b03b | 5 | private static double[] getSupportPoints(int curvePoints,int lineNumber, double[] lowPrices) {
double[] sPoints = new double[lineNumber];
for(int i =0;i<lineNumber-1;i++){
double price = 999999999;
for(int j=-(curvePoints);j<=0;j++){
if((i+j>=0) && (i+j<lineNum... |
3ca7eae8-30cc-49e0-9cb7-b912f62b667c | 1 | public String[] nextStrings(int n) throws IOException {
String[] res = new String[n];
for (int i = 0; i < n; ++i) {
res[i] = next();
}
return res;
} |
3d0add58-43ef-4743-ae1c-5c62dc96f664 | 3 | public final 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)));
}
... |
9599e508-370f-4e3c-985c-0a4092f10f19 | 3 | public static byte menuAbrirCuentaClienteNuevo(){
byte op=0;
do{
try{
System.out.println("Cliente nuevo");
System.out.println("1. Abrir Cuenta Corriente");
System.out.println("2. Abrir Cuenta de Ahorro");
System.out.print("OP => ");
BufferedReader stdin=new BufferedReader(new InputStreamReader(Syst... |
5fd26728-2d1c-4acf-bfd9-56aebf233229 | 6 | public void init() {
if (wizzard == null && wizzardId != 0) {
wizzard = towerService.findWizzard(wizzardId);
} else if (wizzard == null && wizzardId == 0) {
wizzard = new Sorcerer();
}
if (wizzard == null) {
try {
FacesContext.getCurren... |
56c6b3f7-7f5e-405d-a6ad-e96fd5262d80 | 2 | @Override
public void Consultar() throws SQLException
{
try
{
Conexion.GetInstancia().Conectar();
ResultSet rs = Conexion.GetInstancia().EjecutarConsulta("SELECT Nom_Sucursal ,Ciu_Sucursal ,Dir_Sucursal,Tel_Sucursal FROM Sucursal WHERE Cod_Sucursal ='"+ObSucursal.getCod_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.