method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ac5fc7f7-fc59-4615-bd68-7b91fbd90a98 | 0 | public void setEventId(int eventId) {
this.eventId = eventId;
} |
5af5c01a-0418-4e5b-948f-d6a620449eec | 1 | public void test_getMillis_long() {
assertEquals(0L, iField.getMillis(0L));
assertEquals(1234L * 90L, iField.getMillis(1234L));
assertEquals(-1234L * 90L, iField.getMillis(-1234L));
try {
iField.getMillis(LONG_MAX);
fail();
} catch (ArithmeticException ex)... |
417174dc-02f1-49a4-a3d3-d9692dbfea6e | 2 | private void executeQuery(String query, Connection conn) throws TableUpdateException {
if (query.length() > 0) {
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(query);
ps.executeUpdate();
} catch (SQLException e) {
throw new TableUpdateException(e.getMessage());
} finally {
... |
c46127f1-5d9b-4890-9e79-50d6e1af8508 | 2 | private void send(String prefix, CommandSender sender, Object... args) {
List<String> messages = getStrings(this, args);
for (int i = 0; i < messages.size(); i++) {
if (i == 0) {
sender.sendMessage(prefix + " " + messages.get(i));
} else {
sender.s... |
3972a87e-5c5c-46fc-b28e-6e4f809dba56 | 0 | public String getName() {
return name;
} |
d4c66682-146c-419d-bf69-1960456c4726 | 9 | public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (this.averageGroundLevel < 0)
{
this.averageGroundLevel = this.getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (this.averageGroundLevel < 0... |
1156894a-3707-402c-a558-3b8124b46f11 | 7 | public static Stella_Object getNextToken(Cons options) {
if (!Stella.insideWithTokenizerP()) {
{ Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();
try {
Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
Stella.signalTranslationError();
if (!(Stella.su... |
9344a200-da6c-4e17-8ecf-0c73fae273eb | 4 | public int solution(int x, int[] array) {
boolean[] leaf = new boolean[x + 1];
long sumOfLeavesNeeded = sumOfAllPositiveNumbersUpTo(x);
long currentSum = 0;
for (int i = 0; i < array.length; i++) {
int position = array[i];
if (position > x || leaf[position]) {
continue;
}
leaf[position] = true;... |
48803945-607b-4cf2-9a16-c5f9a85f9a2d | 8 | private static void findAndAddClassesInPackageByFile(String packageName, String packagePath, final boolean recursive,
Set<Class<?>> classes) {
// 获取此包的目录 建立一个File
File dir = new File(packagePath);
// 如果不存在或者 也不是目录就直接返回
if (!dir.exists() || !dir.isDirectory()) {
// log.warn("用户定义包名 " + packageName + " 下没有任... |
e7f95bdb-cd8b-4b34-8417-424856cd8979 | 6 | protected void loadPathway2HasEvent() {
String name = "Pathway_2_hasEvent";
String fileName = dirName + name + ".txt";
if (verbose) Timer.showStdErr("Loading " + name + " from '" + fileName + "'");
int i = 1;
for (String line : Gpr.readFile(fileName).split("\n")) {
// Parse line
String rec[] = line.spl... |
075c5dce-5d4e-4264-b1fa-69499497ddcb | 3 | public void eatPlant(Plant plant) {
if (feeding == false) {
time = System.currentTimeMillis();
feeding = true ;
color = Color.red;
}
if (System.currentTimeMillis() < time + wait) {
this.speed = 0 ;
if(new Random().nextInt(100) < SEED_GATHERING_RATE){
seeds += 1;
plant.isEaten();
}
}els... |
31abc8a3-c408-4ecc-93b2-204e0d55a6b2 | 8 | public static boolean isAssignable(Class<?> lhsType, Class<?> rhsType) {
Assert.notNull(lhsType, "Left-hand side type must not be null");
Assert.notNull(rhsType, "Right-hand side type must not be null");
if (lhsType.isAssignableFrom(rhsType)) {
return true;
}
if (lhsType.isPrimitive()) {
Class resolvedP... |
62830c26-0eeb-4da6-bd11-72edc19c9018 | 4 | @SuppressWarnings("rawtypes")
@Override public boolean equals(Object o) {
if (o instanceof Entry) {
Entry other = (Entry) o;
return (key == null ? other.getKey() == null : key.equals(other.getKey()))
&& (value == null ? other.getValue() == null : value.equals(other.getValue()));
... |
23d534d0-77a3-4e9c-9a7a-7f77e3beebc9 | 3 | @EventHandler
public void onItemSpawn(ItemSpawnEvent e)
{
if(e.getEntity().getItemStack().equals(QuestCompass.getCompass()))
{
e.setCancelled(true);
return;
}
for(String key : QuestBook.getBooks().keySet())
{
if(e.getEntity().getItemStack().equals(QuestBook.getBook(key)))
{
e.setCancelled... |
b5305d81-f0e5-47af-a1ad-b128aa62d032 | 3 | private static Integer getTime(final String timeData) {
String[] vArray = timeData.split("\\s");
int time = 1;
if (vArray.length == 2
&& vArray[0].equals("version")
&& vArray[1].matches("[0-9]+")) {
Integer.parseInt(vArray[1]);
} else {
... |
5923cb1a-0e41-43c6-aed1-cc333258dc82 | 3 | @Override
public boolean halt() {
if(maximum){
if(gBest >= acceptableSolution){
return true;
}else{
return false;
}
}else{
if(gBest <= acceptableSolution){
return true;
}else{
return false;
}
}
} |
260e242f-aa76-41e2-ac6f-0b536763450b | 6 | @Override
public void run() {
try {
playFade();
playCalmLoop();
} catch (InterruptedException ex) {
try {
//Logger.getLogger(MusicController.class.getName()).log(Level.SEVERE, null, ex);
interupted=true;
... |
950c477a-890c-4ef4-9bac-274ad407e24d | 8 | public static boolean verif(Ship ship, int row, int column, Orientation orientation, Player player)
{
Grid grid = player.getGridJoueur();
int size = ship.getSize();
boolean res = true;
if (orientation.isHorizontal())
{
if (column+size > 10)
{
... |
f5dc7798-8749-4ccb-8550-e222f70a2215 | 5 | @Override
public void paintComponent(Graphics g)
{
int width = getWidth();
int height = getHeight();
if (mScale == 0.0f)
{
int xExtent = Math.max(Math.abs(mCellSheet.getCurrentMaxX()), Math.abs(mCellSheet.getCurrentMinX()));
int yExtent = Math.max(Math.abs(mCellSheet.getCurrentMaxY()), Math.a... |
9784fb73-ed52-443d-95b9-f369c5334633 | 1 | public Bank(int n, double initialBalance)
{
accounts = new double[n];
for (int i = 0; i < accounts.length; i++)
accounts[i] = initialBalance;
} |
e2ab4f07-a95e-4702-9ba3-d81c4e8d86d8 | 6 | @Override
public void refresh(RefreshEvent event) {
LocalGameRefreshEvent ev = (LocalGameRefreshEvent) event;
WorldModel wm = (WorldModel) ev.getSource();
int i = ev.getX();
int j = ev.getY();
AbstractState s = wm.getState(i, j);
if (s.getFlag() == AbstractSt... |
1bc6bc27-5b48-4b84-91c0-e16c21369801 | 2 | public void paint (Graphics2D pen) {
for (Spring s : mySprings) {
s.paint(pen);
}
for (Mass m : myMasses) {
m.paint(pen);
}
} |
9043c287-2f31-4fc0-8515-11667f2909c3 | 6 | tuple<node,Long> findInM(int[] k, node cnode) throws valid_not_checked, pval_error, make_key_error
{
if (cnode.mfilled==0)
return new tuple<node,Long>(null,(long)0);
long dist,min;
int in;
node minnode,tnode;
minnode=cnode.getMtable(0);
min=common.compareKeys(k,minnode.getKey());
min=(long)Math.abs(m... |
f8fd0e49-ed7f-40f6-a247-bafcdb5a3e22 | 6 | private boolean saveFile(String name){
boolean saveSuccessful = false;
// Only save if there's a valid file name
if(name != null && !name.trim().isEmpty()){
// Clean the name from any path that might have been provided by the user
name = FileUtils.getTextWithoutPath(name)... |
ecd13ddf-954b-49c8-9f06-505e8d0c2aec | 2 | public static Utilisateur selectUtilisateurById(int id) throws SQLException {
String query = null;
Utilisateur Util = new Utilisateur();
ResultSet resultat;
try {
query = "SELECT * from UTILISATEUR where ID_UTILISATEUR=? ";
PreparedStatement pStatement = Connec... |
a7d97b10-79a7-44bf-baf4-7221adf8f5b7 | 5 | protected PathTraceMaterial regionIsHomogeneous( SolidNode sn, int rx, int ry, int rz, int rw, int rh, int rd )
throws DereferenceException
{
SolidNode subNode = nodeDereffer.deref(sn.subNode(rx, ry, rz), SolidNode.class);
PathTraceMaterial mat0 = nodeIsHomogeneous(subNode);
if( mat0 == null ) return null;
... |
8f028f95-059f-42b3-bcbc-a68df933930e | 6 | public String toString() {
if (this == tObject)
return "java.lang.Object";
if (ifaces.length == 0)
return clazz.getName();
if (clazz == null && ifaces.length == 1)
return ifaces[0].getName();
StringBuffer sb = new StringBuffer("{");
String comma = "";
if (clazz != null) {
sb = sb.append(clazz.... |
c4740a86-ee9a-4791-8cc0-422533fbe339 | 3 | private void copyPALtoBGRA(ByteBuffer buffer, byte[] curLine) {
if(paletteA != null) {
for(int i=1,n=curLine.length ; i<n ; i+=1) {
int idx = curLine[i] & 255;
byte r = palette[idx*3 + 0];
byte g = palette[idx*3 + 1];
byte b = palette[i... |
2ba7e3e0-01f3-422b-a89f-cc53ea128b74 | 7 | public void setLink(boolean input, int val) throws Exception {
m_input = input;
if (input) {
m_type = PURE_INPUT;
}
else {
m_type = PURE_OUTPUT;
}
if (val < 0 || (input && val > m_instances.numAttributes())
|| (!input && m_instances.classAttribute().isNominal()
&... |
fb2d811d-c666-49f5-a2e3-5de03b99f01b | 1 | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
java.security.cert.X509Certificate[] chain = null;
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
KeyStore tks = KeyStore.getInstance("JKS");
tks.load(this.getClas... |
1e181fab-9eb5-4617-a2aa-b20b1fe8f3b0 | 7 | private void quickPrioritize(CategorizedProblem[] problemList, int left, int right) {
if (left >= right) return;
// sort the problems by their priority... starting with the highest priority
int original_left = left;
int original_right = right;
int mid = computePriority(problemList[left + (right - left) / 2]);
do... |
54e02811-0838-4cd7-a882-2b226de42e37 | 3 | public void end() {
running = false;
for (BasicZombie zombie : basicZombieList) {
zombie.die();
}
basicZombieList = new ArrayList<BasicZombie>();
for (Bullet bullet : bulletList) {
bullet.alive = false;
}
bulletList = new ArrayList<Bullet>();
for (Missile missile : missileList) {
missile.alive ... |
5af22c4f-6c04-4ef4-a043-3b162960cb9c | 7 | private void balanceIfNecessary(TreeNode node) {
if (node.getBalanceFactor() == 2) {
if (node.hasRightChild() && node.rightChild.getBalanceFactor() == -2) {
node.rotateRightLeft();
} else {
node.rotateLeft();
}
} else if (node.getBalanceFactor() == -2) {
if (node.hasLeftChild() && node.l... |
f204f8f1-13da-45a8-b44b-941607748b4c | 1 | public static void main(String[] args)
{
ArrayList list = new ArrayList();
list.add(new Integer(1));
list.add(new Integer(2));
list.add(new Integer(3));
list.add(new Integer(4));
int sum = 0;
for (int i = 0; i < list.size(); i++)
{
int value = ((Integer) list.get(i)).intValue();
sum += value;
}... |
b8124edd-6a66-4a42-8237-4f97c101913b | 9 | public String encodeValues() throws EncodeException {
StringBuilder res = new StringBuilder();
if (this.values != null && this.values.length > 0) {
for (Object value : this.values) {
if (value instanceof Integer) {
res.append("int:");
} els... |
d9b17961-759c-4b42-ae19-b901ca7fd8dc | 2 | public void testPropertySetHour() {
LocalDateTime test = new LocalDateTime(2005, 6, 9, 10, 20, 30, 40);
LocalDateTime copy = test.hourOfDay().setCopy(12);
check(test, 2005, 6, 9, 10, 20, 30, 40);
check(copy, 2005, 6, 9, 12, 20, 30, 40);
try {
test.hourOfDay()... |
2b83e738-758f-4b61-9faa-a2ba1b457f1e | 7 | synchronized public void refreshLogs () {
try {
displayAreaDoc.remove(0, displayAreaDoc.getLength());
} catch (Exception e) {
// ignore
}
List<LogEntry> entries = Logger.getLogEntries();
for (LogEntry entry : entries) {
if ((logSource == LogSo... |
7e651bb1-6f89-48c8-97b8-e45afab35639 | 8 | public Matrix solve (Matrix B) {
if (B.getRowDimension() != n) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!isspd) {
throw new RuntimeException("Matrix is not symmetric positive definite.");
}
// Copy right hand side.
double[][]... |
1be3452c-56da-48a5-bcfa-33f6d6e4b16b | 5 | public boolean equals(Person other) {
try {
if (((other.nachname.equals(this.nachname) && other.alter == this.alter))
&& ((other.vorname.equals(this.vorname) && other.alter == this.alter))) {
return true;
}
return false;
} catch (Exception e) {
// TODO Auto-generated catch block
// e.print... |
b20b2514-6946-4754-b0bb-928ca2914873 | 2 | public static Map<String,Producto> leerFichero(Map<String,Producto> array) throws NumberFormatException, Exception{
try{
array=new HashMap<String,Producto>();
BufferedReader stdin=Files.newBufferedReader(path,
java.nio.charset.StandardCharsets.UTF_8);
String linea="";
while((linea=stdin.readLi... |
a8b1b0ab-0a1d-4cc2-8595-4e258b93428a | 3 | private static void measuredDeletionTest(String testName, int setSize, int threadCount) {
initializationTests();
// Delete all songs from db
insertSongs(setSize);
ArrayList<Integer> songIds = dbModel.getAllSongIds();
long start = System.currentTimeMillis();
for(Inte... |
755f5e94-5ac1-4a50-8f7d-d26ed377ac9b | 4 | public Variable getArrayVar(String identiName, ArrayList<ArithmeticResult> arrayOffsets) {
if (localVTable.hasDecl(identiName) && localVTable.lookUpVar(identiName).isArray()) {
return new ArrayVar(localVTable.lookUpVar(identiName), arrayOffsets);
} else if (globalVTable.hasDecl(identiName) && globalVTable.lookUp... |
1439e326-4d41-4f21-828f-e47ddecc6d0b | 1 | public Image colorBanners(Image image, Color color){
if(image == null)
{
return null;
}
//create a buffered image, of type argb
BufferedImage biTemp = new BufferedImage(image.getWidth(null),image.getHeight(null),BufferedImage.TYPE_INT_ARGB);
//make a graphic... |
f2d9f7af-3ce6-4c3e-b9c6-cf5664f5af95 | 9 | public static Color[] parsePalette(String value)
{
String val = null;
{ int ptr = 0;
char[] buf = new char[value.length()];
for (int i = 0, n = buf.length; i < n; i++)
{ char c = value.charAt(i);
if ((c != '\033') && (c != ']'))
if (c == ';')
if ((i > 0) && (buf[ptr - 1] == '4'))
... |
ad05c07e-0010-4168-9fcc-b343d418d86c | 1 | public IteratingPlayerContainer(Game game, int numberOfPlayers) {
this.game = game;
List<String> playerIds = Lists.newArrayList();
for (int i = 0; i < numberOfPlayers; i++) {
String playerId = String.valueOf(42 + i);
playerIds.add(playerId);
playersInfo.add(ImmutableMap.<String... |
12361b17-46e0-400b-9124-b38464ff4f57 | 5 | public static void moveDown(JoeTree tree, OutlineLayoutManager layout) {
Node oldestNode = tree.getOldestInSelection();
Node node = oldestNode.nextSibling();
if (node == oldestNode) {
return;
}
// Put the Undoable onto the UndoQueue
CompoundUndoableMove undoable = new CompoundUndoableMove(node.getParent... |
2bc74870-21fd-49e6-a0d0-3d0bf893ffd7 | 0 | public int getHeight() {
return height;
} |
e74ac74a-28f7-4703-94ef-d81603b87486 | 0 | public void setNovUnidad(String novUnidad) {
this.novUnidad = novUnidad;
} |
ab8d5911-32f8-4b4d-8bbb-6404ef9c211f | 0 | @Override
public void buildPart1() {
} |
8dad1c9d-8ca9-4345-b04f-b1143ff98cf2 | 8 | public PadPanelController(String padId, boolean groupPad) {
actualPadId = padId;
Date lastEditedTime = epLite.getPadLastEditedTime(actualPadId);
String padText = epLite.getPadText(actualPadId);
final String roPadId = epLite.getReadOnlyPadId(actualPadId);
String padRev = epLite.getPadRevisionCount(actualPadId)... |
37f19d7c-d279-42aa-a2d8-b7b16a4105c1 | 8 | final public void Numeric_type() throws ParseException {
/*@bgen(jjtree) Numeric_type */
SimpleNode jjtn000 = new SimpleNode(JJTNUMERIC_TYPE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Integral_type();
} catch (Throwabl... |
fcc13fbd-86dd-4db6-b14b-08ad17332a90 | 6 | private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
102698e7-bb91-48a6-af88-1b9119d0ca05 | 6 | @Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
boolean success = false;
if (!owningPlugin.isEnabled()) {
return false;
}
if (!testPermission(sender)) {
return true;
}
try {
success = ... |
369609f7-c5ac-4c2e-95f8-9ebe2c691d41 | 2 | public int askNbPion(Territoire t){
int nbPion;
int enMain = partieEnCours.getJoueurEnCours().getPeuple().getNbUniteEnMain();
try {
do {
nbPion = Prompt.askInt("Nombre de pions à replacer sur ce territoire. Pour l'abandonner, choisir 0.");
} while(nbPion > (enMain + t.getNbUnite()));... |
cf7f229b-fe80-46c1-a982-43017cf21ddd | 7 | public static boolean classImplementsInterface( Class<?> c,
String interfaceName,
boolean includeSuperClasses ) {
Class<?>[] ifs = c.getInterfaces();
boolean isFileHandler = false;
for( int i = 0; i < ifs.length && !isFileHandler; i++ ) {
if( ifs[i].getName().equals(interfaceName) ) ... |
01469d89-fe07-43bc-b58b-071e9064ebf2 | 0 | public Date getDate() {
return date;
} |
9c7ca7f1-650b-4af3-a043-dfee69a8b5f1 | 0 | private void remCallFromConnection(Long connectionId, Long callId) {
conns.get(connectionId).remove(callId);
} |
df004bb5-6046-46c1-9c57-0cd6624a1d73 | 5 | private void generateXmlFile() throws Exception {
try {
String fileName = inputFile.getName().split("\\.")[0];
File outputFile = new File(outputFolder, fileName + ".xml");
Element rootElement = new Element(fileName + "List");
for (String[] lines : dataList) {
... |
ef4881b5-32c1-4678-8ac1-2a515aceb75e | 3 | private String removeStopWordsAndSort(String query,
HashSet<String> stopwordsSet) {
String[] splitQuery = query.split(" ");
Arrays.sort(splitQuery);
StringBuilder sb = new StringBuilder();
for (int i=0; i < splitQuery.length; i++) {
// Performing stemming of individual word
/*
* Stemmer st = new S... |
00bf59b4-670e-4b81-bdb4-92939c6b4a0d | 3 | private static String getValue(Element element, String tagName){
NodeList nodeList = element.getElementsByTagName(tagName);
if(nodeList.getLength()==0){
// System.err.println("The tag " + tagName + " is not present.");
return null;
// the tag is not present
} e... |
1a9353f4-daac-4b93-94cb-0ddffc3872d3 | 8 | private BitSet selectEllipses(String str) {
int n = view.getNumberOfInstances(EllipseComponent.class);
if (n == 0)
return null;
BitSet bs = new BitSet(n);
if ("selected".equalsIgnoreCase(str)) {
for (int i = 0; i < n; i++) {
if (view.getEllipse(i).isSelected())
bs.set(i);
}
return bs;
}
... |
7b1b3ee8-762d-4811-a97c-07a4f3946b76 | 8 | private void begin() {
int primes[] = { 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43,
47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109,
113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179,
181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241,
251, 257, 263, 269, 271... |
c0031f17-2bb0-460e-83ec-6d36cdd7df60 | 4 | public void runSimplexe() throws MatrixException
{
Matrice Nbarre;
Matrice bBarre;
Matrice delta;
Matrice ciDansB = new Matrice(this.A.getNbLines(), 1);
Matrice iDansB = new Matrice(this.A.getNbLines(), 1);
Matrice temp = new Matrice(this.A.getNbLines(), 1);
b... |
e59e2178-8061-406b-91f7-3a97bf6fe3f2 | 8 | @Override
public void render(Graphics g, Visibility visibility, float x, float y, float scale) {
if(visibility == Visibility.VISIBLE) {
boolean hasSomeEntities = occupying.size() > 0;
boolean hasSomeEntering = entering.size() > 0;
boolean hasSomeLeaving = leaving.size() > 0;
if(hasSomeEntities) {
if(... |
b1eb55e6-1d12-4c4d-b4a1-0c452f538b27 | 4 | private int createFragShader(String filename) {
int fragShader = ARBShaderObjects.glCreateShaderObjectARB(35632);
if (fragShader == 0) {
return 0;
}
String fragCode = "";
try
{
BufferedReader reader = new BufferedReader(new InputStreamReader(Shader.class.getResourceAsStream(filename)... |
eacf0cfa-1f8b-41d4-b7e4-09f5319f2a15 | 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... |
e18a9fc9-8eb0-4fec-ae80-8290bf823c4d | 5 | public String getTeamList() {
if (getTeamNumb().length() == 1) {
spacereturnlength = " ";
} else if (getTeamNumb().length() == 2) {
spacereturnlength = " ";
} else if (getTeamNumb().length() == 3) {
spacereturnlength = " ";
... |
81ba4dfb-709d-4e52-97cb-7d25c2445d05 | 3 | public static boolean isValidWorm(Worm worm){
if(worm == null)
return false;
if(!worm.isAlive())
return false;
if(worm.getTeam() != null)
return false;
return true;
} |
30d70918-cf1e-492a-908b-a0d8d62b91d8 | 8 | public int binarsearchInsert(int[] A, int target, int begin, int end) {
int mid = (begin+end) / 2;
if (begin > end) return -1; // not found
if (A[mid] == target) {
return mid;
} else if (target < A[mid]) {
if (mid > 0) {
if (targe... |
17b21d7f-60ff-403d-82d1-45d53e6cd99d | 9 | FloatValueInterpolator(Alpha alpha, float k[], float v[]) {
super(alpha);
// Check that first knot = 0.0f
knotsLength = k.length;
if (k[0] < -0.0001 || k[0] > 0.0001) {
throw new IllegalArgumentException(J3dUtilsI18N.getString("FloatValueInterpolator0"));
}
// Che... |
6d75d306-bc7b-4141-b09d-5f88b78945f9 | 5 | public void loadDatabase( String file ) throws FileNotFoundException {
if ( file == null ) {
file = userHome+"/.pwman/pwman.db";
}
if ( !new File(file).exists() ) {
throw new FileNotFoundException( "SQLite-Database not found" );
}
// Connect to database file. If not exists, it will be created
... |
a36df886-b61d-4b74-9f37-8f2521f02dda | 3 | @Override
public void render(float delta) {
highscoreView.render(delta);
timeElapsed+=delta;
if(timeElapsed>1 && Gdx.input.justTouched() || Gdx.input.isKeyPressed(Keys.BACK)){
this.game.setScreen(new TitleScreen(game));
}
} |
60a073d3-ca80-4c04-a35b-76159ad25cf2 | 6 | private static void RegisterChild(jpvmTaskId client, jpvmBuffer req) {
int regNum = -1;
// Child process reporting in. Notify the remote client that
// requested this local task creation.
try {
regNum = req.upkint();
}
catch (jpvmException jpe) {
perror("bad RegisterChild invocation");
return;... |
b1ad7789-f0f4-404f-9127-5f5f41376d6d | 4 | public Tile getTile(int x, int y){
if(x < 0 || y < 0 || x >= worldWidth || y >= worldHeight) return null;
return Tile.getTileById(mapData.get((y * worldWidth) + x));
} |
dace1f0e-f94f-45b4-a7af-8b3108ff1a87 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PhpposSalesItemsTaxesEntityPK that = (PhpposSalesItemsTaxesEntityPK) o;
if (itemId != that.itemId) return false;
if (Double.compare(that.percen... |
130237d1-f113-464c-aa69-ac9992e0336a | 2 | public void kirjoitaTiedosto(
String tiedosto,
String rivi,
boolean ylikirjoitus) {
if (ylikirjoitus) {
try {
FileWriter kirjoittaja = new FileWriter(tiedosto);
kirjoittaja.write(rivi + "\n");
kirjoittaja.close();
... |
56862942-7fcb-4996-8e64-286dc1e8d49e | 4 | public static void main(String[] args) {
/*
The For Loop Construct
* A for loop is usually used to execute a set of statements a fixed number of times.
for(starting point; condition; ending point (++ or --))
Parts of a For Loop
Initialization ... |
c9107abe-d4c0-424b-9051-7c4870d27c73 | 0 | public MarkerTile(AbstractPlay relatedPlay){
this.relatedPlay=relatedPlay;
this.setImage(marker);
} |
d7c012fa-74d7-4e96-be9d-4c755c4cff87 | 9 | public <V, E> void export(
TGFProvider<? super V, ? super E> provider,
Digraph<? extends V, ? extends E> digraph,
Writer writer) throws IOException {
Map<V, Integer> index = new HashMap<V, Integer>();
int n = 0;
for (V vertex : digraph.vertices()) {
++n;
index.put(vertex, n);
writer.write(String... |
7854fe34-d757-447a-8d8b-b24eaea51fb3 | 6 | private JPanel countryInfoPanel(Board board) {
countryInfoPanel = new JPanel();
countryInfoPanel.setPreferredSize(new Dimension(320, 980));
countryInfoPanel.setLayout(new GridBagLayout());
northAmericaPanel = new JPanel();
northAmericaPanel.setPreferredSize(new Dimension(320, 100));
northAmericaPane... |
fea395bd-9249-4a7b-bd9e-53e29df64b36 | 7 | public static void addFils(Personne pers, Fils f) {
List enfants = new ArrayList<Personne>();
try {
if (pers instanceof Pere) {//Un pere ajoute un fils
//On recupere la liste des enfants du pere
enfants = ((Pere) pers).getEnfants();
f.setPere((... |
078d6e81-f780-4f85-92e2-47d1f31dc4fd | 2 | public static void main(String[] args) {
BotMain myBot = new BotMain();
myBot.setVerbose(true);
try {
myBot.connect("irc.rizon.net");
} catch (IOException ex) {
Logger.getLogger(UOSIRCBot.class.getName()).log(Level.SEVERE, null, ex);
} ca... |
deba1a88-df47-430b-9e41-f1eead3806c5 | 3 | public static String formatTimeDiff(long last) {
long time = System.currentTimeMillis() - last;
final int sec = (int) (time / 1000), h = sec / 3600, m = sec / 60 % 60, s = sec % 60;
return (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":"
+ (s < 10 ? "0" + s : s);
} |
b63cc2f2-a149-4aa3-9269-8ddab93b61e0 | 4 | public double characterHitpoint()
{
if (P2character.equals("White"))
{
return whiteKnight.characterHitpoint();
}
else if (P2character.equals("Bond"))
{
return jamesBond.characterHitpoint();
}
else if (P2character.equals("Ninja"))
... |
7953f1f9-7f13-45f4-8391-4bea05e85545 | 7 | private boolean valiDateInput(){
if(regnameText.getText().trim().length()==0){
JOptionPane.showMessageDialog(this, "Name can not be blank");
return false;
}
else if(regcontactNumberText.getText().trim().length()!=10){
JOptionPane.showMessageDialog(this, "Co... |
d933923c-ebe0-49ac-8d97-c9fd79d95d9c | 5 | public static Grammar parseInput(String[] lines) {
List<TerminalSymbol> tsymbols = new ArrayList<TerminalSymbol>();
List<NonTerminalSymbol> nsymbols = new ArrayList<NonTerminalSymbol>();
List<Production> productions = new ArrayList<Production>();
Set<TerminalSymbol> sync = new HashSet<TerminalSymbol>();
Stri... |
dbcdb4e2-2a02-4b00-a22e-4490df22c621 | 7 | public synchronized String toString()
{
StringBuilder buffer = new StringBuilder();
buffer.append("Local: ").append(getLocalNode()).append("\n");
int alive = 0;
int dead = 0;
int unknown = 0;
for(Bucket bucket : getAllBuckets())
{
... |
acefcd72-7173-404b-83eb-d6c84f493326 | 9 | protected synchronized void dispose(boolean cache) {
if (kidsReferences != null) {
if (!cache) {
kidsReferences.clear();
kidsReferences.trimToSize();
}
}
if (kidsPageAndPages != null) {
for (Object pageOrPages : kidsPageAndPages... |
c247812c-edc9-4a3b-b907-329e7cc6e2c2 | 9 | public static IConstants.ResponseType update(Client client,
UpdateDataRequestMessage updateDataRequestMessage) {
boolean update = false;
IConstants.ResponseType responseType = IConstants.ResponseType.failed;
EntityManager entityManager = PersistenceManager.getInstance()
.getEntityManager();
EntityTransac... |
20bf873c-1c8e-48a6-9747-deb043fd7a87 | 6 | public void whoGoesFirst()
{
int x=0;
if (playsFirst.getSelectedIndex()!=2)
{
if (playsFirst.getSelectedIndex()!=you)
flipYou();
players[playsFirst.getSelectedIndex()].getTimer().start();
x=playsFirst.getSelectedIndex();
}
else
{
int rand=(int)(Math.random()*2);
JOptionPane.showM... |
d5d5dd33-56d2-430f-ae5b-758f5c732f08 | 4 | private static void closeConnection(Connection con) {
if (con != null) {
try {
if (!con.isClosed()) { // 关闭没有关闭
con.close();
}
} catch (SQLException ex) {
LOGGER.debug("关闭JDBC Connection失败", ex);
} catch (Throwable ex) {
// We don't trust the JDBC driver: It might throw
// RuntimeExc... |
ed623bda-39de-4ef0-9b51-0e6b57cc1c17 | 0 | @Override
public boolean hasTickets(TicketPoolQueryArgs args) throws Exception{
Iterable<PlanTicket> planTickets = this.query(args);
return Queries.query(planTickets).any();
} |
b5f7121a-4188-402a-a347-dae9443b6a81 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
e88750a7-d56a-417b-825b-d1f5f02ae054 | 5 | protected void onRender(GraphicsHelper gh) {
gh.g().setAntiAlias(true);
Circle c = new Circle(xOnView(pos.x)+r,yOnView(pos.y)+r,r,32);
gh.g().fill(c,new ShapeFill(){
public Color colorAt(Shape shape, float x, float y) {
return Colors.merge(cBgTop,cBgBottom,(y-shape.getMinY())/(shape.getMaxY()-shape.g... |
a2c20b7a-cfdb-4212-a01f-bbd464a85bed | 1 | public List<Proveedor> ObtenerProveedor(String consulta){
List<Proveedor> lista=new ArrayList<Proveedor>();
if (!consulta.equals("")) {
lista=cx.getObjects(consulta);
}else {
lista=null;
}
return lista;
} |
2a127137-b46b-4951-96da-32e7fbe7c9be | 0 | public int getRow()
{
return row;
} |
4db50120-da4c-4d87-9e46-5c7dde2cec26 | 4 | public PoseReceiverShaker(ShakingAnalyzer analyzer) {
this.analyzer = analyzer;
observer = null;
final Object observee = this;
Timer t = new Timer();
TimerTask tt = new TimerTask(){
public void run() {
if(!initialized)
return;
long currTime = System.currentTimeMillis();
if (currTime -... |
4ebd7880-37a8-4cf9-9282-cb8b96264952 | 1 | public static void colorFloors(Graphics g, Rectangle f){
g.setColor(PlatformManager.floorColor);
try {
g.fillRect(f.x - CharacterManager.xs, f.y - CharacterManager.ys, f.width, f.height);
}
catch (Exception e){}
} |
76ac752d-3ef1-42a8-9fc1-585d49666524 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Curso)) {
return false;
}
Curso other = (Curso) object;
if ((this.idCurso == null && other.idCurso != null) || ... |
b56933b2-f5fe-410c-9778-17b595a193e2 | 5 | protected void fireReceiveQuery(final ISocketServerConnection ssc,
IRemoteCallObjectMetaData meta, IRemoteCallObjectData data,
final long connectionId, final long callId) throws Exception {
//Exception tmpException = null;
ExceptionList excl = new ExceptionList();
//.
try {
Obj... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.